Answered
~ in Matlab function
It is a placeholder for the optional second argument but indicates to not assign to a variable -- in the above call, there is no...

3 years ago | 0

| accepted

Answered
How to plot the mean and standard deviation of collected data
I don't get any such error if I just work at the command line... i1=5; i2=2400; tT1=readtable('med_tube_19_187g_1.csv'); tT2=...

3 years ago | 1

| accepted

Answered
Two X axes with different directions
x1 = 1:20; % axis in tau scale x2 = x1.*(128/3); % axis in ms to s /1000 x3 = 1./(x2./1000); % axis in Hz figure hL=plot(x2,...

3 years ago | 0

Answered
How are the following methods to compute correlation different?
But if you create T from your two mat arrays as T=[mat1 mat2]: then the results are all the same; if you got something differen...

3 years ago | 0

| accepted

Answered
Imported data becomes NaN
opt=detectImportOptions(websave('CA_dvs.xlsx','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1159783/CA_dvs.xls...

3 years ago | 0

| accepted

Answered
How to use text command with text left of xline and \rightarrow pointing to xline? Easy to place text right of xline with \leftarrow pointing from beginning of text to xline.
You could adjust the starting point to move the prepended right arrow where want it, but don't fight it; just put the two pieces...

3 years ago | 0

| accepted

Answered
How to extract two type of data from text without losing indexing?
file=readlines(websave('Test.txt','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1159058/Test.txt')); file(1)=...

3 years ago | 0

| accepted

Answered
I have multiple vectors of order (1000*24)have calculated the fitness of all these.Now the want the maximum out of fitness and want the corresponding vectors and index of that
>> Clansize_11=size(AA) >> Clansize = 10 24 >> will return a 2-vector of the number rows/columns of AA. What then d...

3 years ago | 0

Answered
I am trying to run a simulation 1000 times and generate a matrix 600x1000. My simulation creates a 1x600 vector
Just wrap you function (you DID us a function, didn't you, and not a script?) inside a for...end loop. Preallocate the output a...

3 years ago | 0

Answered
Pull specific data from multiple text files and export it to an excel file.
That's not that big in memory footprint; big in terms of hand-processing, yes, but not a memory issues... data=readlines(websav...

3 years ago | 0

Answered
2-d interpolation in matlab
As per usual, would be far easier to visualize what you're after if would provide a (smallish) sample dataset. But, if by " Kee...

3 years ago | 1

Answered
I have a 3D matrix that is 64 by 700 by 10. I want to add the 700 numbers to result in a 2D 64 by 10 matrix. How do I do that?
A useful but not used commonly enough for to become aware of early on in MATLAB career, generally ... :) S=squeeze(sum(M,2)); ...

3 years ago | 1

| accepted

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

Load more