Answered
Can I get every combination of groups of data in a matrix
A=reshape(1:9,3,3).'; nchoosek(A(:),3) NOTA BENE: This will run out of memory real soon with larger array sizes...

3 years ago | 0

Answered
How to generate matrix based on previous elements?
dt=3; % use variables for data; don't bury magic numbers in code [r,arr]=find(A); % get the arrival ti...

3 years ago | 0

Answered
How can I plot outliers in their correct position with respect to the original data?
You're just plotting the selected array elements against their ordinal number; you need a corollary x value against which to plo...

3 years ago | 0

| accepted

Answered
extract the indices of matrix elements after applying a condition
A = [1.0000 2.0000; 0.1000 1.0000 ; 0.6000 0.4000 ; 5.0000 0.1000 ; 0.4000 0 ; 0.40...

3 years ago | 0

Answered
Convert a sequence of datetimes to seconds from first date
T=['07-Oct-2022 12:46:50';'07-Oct-2022 12:47:21']; DT=datetime(T) Tsec=seconds(DT-DT(1)) Subtracting the first datetime value...

3 years ago | 7

| accepted

Answered
I get Arrays have incompatible sizes for this operation with an elseif statement what do i do?
A character array is just an array of bytes; the length of 'square' is six characters while the 'rectangle' is 9 -- indeed, they...

3 years ago | 1

Answered
Make multiple vectors the same size
t=0.5:0.01:1.3; res=interp1(A(:,1),A(:,2),t).*interp1(B(:,1),B(:,2),t).*cos(interp1(C(:,1),C(:,2),t));

3 years ago | 0

| accepted

Answered
Why do i get the error "inconsistent row/column dimensions" for line a=X\y
This time I formatted your code for you; in future use the "CODE" button to do so (or select code and use CTRL-E). Please add t...

3 years ago | 0

Answered
Data not plotting as a 'stacked' bar chart?
bar is an abomination of an implementation -- it is documented that if the input data are a vector, the 'stacked' option is inte...

3 years ago | 1

Answered
How to transform data to have new minimum, maximum and average values?
OK, this has been rumbling around in back of head since posted -- one way that keeps the original dataset and adjusts them withi...

3 years ago | 0

| accepted

Answered
Tying to make an array of labels for a certain length
Why the min() operation? You'll need the same length of the quality indicator as the height of the data. I'd suggest approachi...

3 years ago | 0

Answered
How to find the difference between two vectors
Well, this is a guess, but it appears that maybe you have x,y data strung together in a single vector and want to separate out t...

3 years ago | 0

| accepted

Answered
Contour plot and line plot
That will have been done with subplot more than likely; the newer tiledlayout could also be used. Is there not the code with th...

3 years ago | 0

| accepted

Answered
fft(x), why divide with L?
The short answer is "Because!" <VBG> The story behind the answer is in the reference document for the FFTW routine that MATLAB...

3 years ago | 0

Answered
I'm adding legend in the graph for the 4 plot in the same graph, please help me in this.
Use something like legend('Y(11)','Y(12)','Y(13)','Y(14)',"Location","northeast"); instead. The legend entries are strings de...

3 years ago | 0

Answered
How to set text position in yyaxis?
t = 1:0.1:10; yyaxis('left'); plot(t, sin(t), 'b.-', 'LineWidth', 2); ylabel('sin'); text(4,0.5,'left=0.5','BackgroundColor'...

3 years ago | 0

Answered
Reading files with different extension from directory
The MATLAB builtin dir() function doesn't have the facility to handle multiple extensions in a single call; there are a couple o...

3 years ago | 1

| accepted

Answered
linspace is causing an error
In %T= (9.68.*n2.^2)./(11.6964.*n2.^2)+(1-n2.^2).*(5.8564-n2.^2).*(sin((2*pi*D)./1)).^2 you're missing a needed set of parenth...

3 years ago | 3

| accepted

Answered
Timestamp in ISO 8601 to yyyy-MM-dd HH:mm:ss
It's a pit(proverbial)a(ppendage) when vendor code produces nonstandard formats... S='0000-00-00T14:26:21:000'; % sample...

3 years ago | 0

| accepted

Answered
How to delete all files with a certain extension?
Because your count variable is being incremented in the outer loop which is running over a dir() list of all files (including su...

3 years ago | 0

| accepted

Answered
I need my graphs to display my data but they are showing up empty
No, the size of a is 1,1; the value of a is 3. Hence, you compute only one value and all your plot is/will be is a single point...

3 years ago | 1

Answered
Polyfit plot just need one line
That looks like your data are just a scatter all over and you're asking polyconf to evaluate the fit and the intervals over all ...

3 years ago | 0

| accepted

Answered
Link Excel spreadsheet to Matlab
sheet=get(ex.sheets,'Item',1); should work. There's a whole litany of what will/won't actually get resolved through the COM e...

3 years ago | 0

Answered
How can one calculate Differentiation of matrix array with time as first column and data as second column ?
g=diff(v(:,2))./diff(v(:,1)); % numerical gradient The gradient vector estimate will be one element shorter than the inpu...

3 years ago | 1

Answered
How to sort data files without actually writing these files
Well, maybe I'll take a shot at it and see if get the idea... First a comment on the existing code -- in ... l = fget...

3 years ago | 0

| accepted

Answered
Read data from .txt file
The file and your local system LOCALE setting aren't in synch it appears -- the default MATLAB locale is US which uses the decim...

3 years ago | 0

Answered
i have to get similar output as i have uploaded.why my data is getting repeated again and again?
Carrying on from @David Hill's most excellent start, tT=readtable(websave('input.csv','https://www.mathworks.com/matlabcentral/...

3 years ago | 0

Answered
read text file - header and numerical part
Q1: A. See fgets to keep newline B: Don't need ExtractBetween, use ExtractAfter; then don't need the actual \n in the d...

3 years ago | 0

| accepted

Answered
How to remove compare 2 arrays so that when there is a in a column, it removes the column in another array
You have only one row logical but three rows of labels??? But, assuming that's expected and the need is to remove all columns t...

3 years ago | 1

| accepted

Answered
How to solve this errror about reading in complex numbers?
Previously answered what appears to be virtually identical Q? <answers/1818965-how-to-read-only-last-2-columns-of-csv-format-fi...

3 years ago | 0

Load more