Answered

Error Message " grpstats requires Statistics and Machine Learning Toolbox"

The ver command will tell you the toolboxes you have installed, but they are not necessarily licensed. Try going to the license ...

Error Message " grpstats requires Statistics and Machine Learning Toolbox"

The ver command will tell you the toolboxes you have installed, but they are not necessarily licensed. Try going to the license ...

18 hours ago | 1

| accepted

Answered

using textscan to find the rest of the line after the specific expression...

The code I posted in your other question ... text=fileread(fileName); expr='(?<=Name = )\w*'; machineName=regexp(text, expr,'...

using textscan to find the rest of the line after the specific expression...

The code I posted in your other question ... text=fileread(fileName); expr='(?<=Name = )\w*'; machineName=regexp(text, expr,'...

21 hours ago | 0

Answered

how to use regexp to get the last characters of a line

Your definition of expr does not have a space between "Machine Name" and the equals sign, but your text example does. When I put...

how to use regexp to get the last characters of a line

Your definition of expr does not have a space between "Machine Name" and the equals sign, but your text example does. When I put...

1 day ago | 0

Answered

How to avoid for loop, when using ecdf for a matrix?

No. Inside the code for ecdf.m, you can see the line that explicitly creates an error message if the input is not a vector. I wo...

How to avoid for loop, when using ecdf for a matrix?

No. Inside the code for ecdf.m, you can see the line that explicitly creates an error message if the input is not a vector. I wo...

1 day ago | 0

| accepted

Answered

Taking middle 4 values of n size array

Here is one way, assuming the number of elements is even: % Input a = rand(1,8); numberElements = numel(a); numberToRemove...

Taking middle 4 values of n size array

Here is one way, assuming the number of elements is even: % Input a = rand(1,8); numberElements = numel(a); numberToRemove...

3 days ago | 0

Answered

Taking middle 4 values of n size array

Here is one way, which will work for either even- or odd-length arrays. It is not efficient. % Input a = rand(1,9); whichEn...

Taking middle 4 values of n size array

Here is one way, which will work for either even- or odd-length arrays. It is not efficient. % Input a = rand(1,9); whichEn...

3 days ago | 0

Answered

write a function that takes any equation as an input

Are you familiar with anonymous functions? That would presumably be the best way to pass "any function" as an argument. Then in...

write a function that takes any equation as an input

Are you familiar with anonymous functions? That would presumably be the best way to pass "any function" as an argument. Then in...

3 days ago | 1

| accepted

Answered

linearly spacing a nX1 matrix

Your problem is still under-specified, and an infinite number of matrices will meet you conditions. Here is one possible solutio...

linearly spacing a nX1 matrix

Your problem is still under-specified, and an infinite number of matrices will meet you conditions. Here is one possible solutio...

3 days ago | 0

| accepted

Answered

Find average y value of a range of numbers from a non linear data set

Your example of averaging the values from 6:10 would be mean(interp1(X,Y,6:10,"previous")) Change where I put 6:10 to be the a...

Find average y value of a range of numbers from a non linear data set

Your example of averaging the values from 6:10 would be mean(interp1(X,Y,6:10,"previous")) Change where I put 6:10 to be the a...

3 days ago | 1

| accepted

Answered

Index exceeds array bounds from CorrCoeff

The problem is that in the first iteration of your loop, you are taking the correlation of two scalar values: corrcoef(X(1,1),X...

Index exceeds array bounds from CorrCoeff

The problem is that in the first iteration of your loop, you are taking the correlation of two scalar values: corrcoef(X(1,1),X...

3 days ago | 0

| accepted

Answered

How to print figure to an .eps file properly?

Try using '-opengl' rather than '-painters' for the renderer.

How to print figure to an .eps file properly?

Try using '-opengl' rather than '-painters' for the renderer.

4 days ago | 0

Answered

Creating means in a table for a specific subnum

I think you might be able to do what you want using the groupsummary function.

Creating means in a table for a specific subnum

I think you might be able to do what you want using the groupsummary function.

5 days ago | 0

| accepted

Answered

How to fit data to a curve with known error bars and draw it?

Do you mean that you want to do a fit where both your x and y variables have known measurement error? (Unlike, say, an ordinary ...

How to fit data to a curve with known error bars and draw it?

Do you mean that you want to do a fit where both your x and y variables have known measurement error? (Unlike, say, an ordinary ...

6 days ago | 0

Answered

Subscript indices must either be real positive integers or logicals.

Unlike some other programming languages (e.g. python), MATLAB has 1-based indexing. The first element of the array A would be re...

Subscript indices must either be real positive integers or logicals.

Unlike some other programming languages (e.g. python), MATLAB has 1-based indexing. The first element of the array A would be re...

6 days ago | 0

Answered

Printing row index or row of a matrix by searching for a particular value?

rowIndex = find(mat(:,1)==31); % Row index row = mat(mat(:,1)==31,:); % Row Note that one doesn't need the find command to get...

Printing row index or row of a matrix by searching for a particular value?

rowIndex = find(mat(:,1)==31); % Row index row = mat(mat(:,1)==31,:); % Row Note that one doesn't need the find command to get...

6 days ago | 0

| accepted

Answered

How to plot below function of two variables

x = 0 : 0.02 : 2; % 2 is not equal to infinity, but it shows the behavior. y = 0 : 0.02 : 2; [xx,yy] = meshgrid(x,y); f =...

How to plot below function of two variables

x = 0 : 0.02 : 2; % 2 is not equal to infinity, but it shows the behavior. y = 0 : 0.02 : 2; [xx,yy] = meshgrid(x,y); f =...

8 days ago | 0

| accepted

Answered

Relate a value obtained with values that formed it (Vector Relationship)

Assuming those are all numeric vectors of the same length, then [min_SLL,min_idx] = min(SLL); min_dx1 = dx1(min_idx); min_dy1...

Relate a value obtained with values that formed it (Vector Relationship)

Assuming those are all numeric vectors of the same length, then [min_SLL,min_idx] = min(SLL); min_dx1 = dx1(min_idx); min_dy1...

9 days ago | 1

| accepted

Answered

How to reshape nested cell arrays in a table

Here is one way: t.Var2 = {reshape(t.Var2{:},4,12)} and analogously for Var3 and Var4. Parsing what that is doing, from the i...

How to reshape nested cell arrays in a table

Here is one way: t.Var2 = {reshape(t.Var2{:},4,12)} and analogously for Var3 and Var4. Parsing what that is doing, from the i...

9 days ago | 1

Answered

How to retrieve data from a website?

According to its documentation page, use of urlread is not recommended. It suggests using webread instead.

How to retrieve data from a website?

According to its documentation page, use of urlread is not recommended. It suggests using webread instead.

9 days ago | 0

Answered

How to crate only 5 plots out of the 20000 iterations?

Use if mod(k,5000)==0 ... end and just figure or figure(k/5000) Just using the figure command (without any argument)...

How to crate only 5 plots out of the 20000 iterations?

Use if mod(k,5000)==0 ... end and just figure or figure(k/5000) Just using the figure command (without any argument)...

10 days ago | 0

| accepted

Answered

lagrangian polynomial function giving the incorrect answer

I don't have a solution for you, but I can say that the line xprod=xprod*((c-Xlist(j))/(Xlist(i)-Xlist(j))); is never reached ...

lagrangian polynomial function giving the incorrect answer

I don't have a solution for you, but I can say that the line xprod=xprod*((c-Xlist(j))/(Xlist(i)-Xlist(j))); is never reached ...

10 days ago | 1

Answered

Arrange be in order of their pairing, and count how many times they appear

[C,~,idx] = unique(B,'row'); D = accumarray(idx,A); 1 + 3 + 6 = 10. ;-)

Arrange be in order of their pairing, and count how many times they appear

[C,~,idx] = unique(B,'row'); D = accumarray(idx,A); 1 + 3 + 6 = 10. ;-)

10 days ago | 0

| accepted

Answered

Find a series of consecutive numbers and change index of them

Data(:,1) = cumsum(diff([Data(1,2); Data(:,2)]) ~= 1); will change the first column to what you want. That's might be a bit "o...

Find a series of consecutive numbers and change index of them

Data(:,1) = cumsum(diff([Data(1,2); Data(:,2)]) ~= 1); will change the first column to what you want. That's might be a bit "o...

11 days ago | 2

| accepted

Answered

while loop mixing number with word

Use a cell array instead: i = 1; a = 5; while (i<10) student{i} = a a=a+5; i = i+1 end See this Answers tuto...

while loop mixing number with word

Use a cell array instead: i = 1; a = 5; while (i<10) student{i} = a a=a+5; i = i+1 end See this Answers tuto...

11 days ago | 0

Answered

Loop not working properly

What you are observing seems correct to me. theta is 0, and phi is constant. This means that even as r increases y is zero (be...

Loop not working properly

What you are observing seems correct to me. theta is 0, and phi is constant. This means that even as r increases y is zero (be...

12 days ago | 0

| accepted

Answered

My licensed Mathworks products (Home Use License )

Quoting from my R2019a Home license agreement: A Named User may install the Programs on up to four (4) different Computers but ...

My licensed Mathworks products (Home Use License )

Quoting from my R2019a Home license agreement: A Named User may install the Programs on up to four (4) different Computers but ...

13 days ago | 0

Answered

How to save Figures using "print" with a filename from a variable?

It's a straightforward extension of what you are doing now. For example k = 1; y = 1989; sprintf('/Users/Figure3/figCI_%d_%d....

How to save Figures using "print" with a filename from a variable?

It's a straightforward extension of what you are doing now. For example k = 1; y = 1989; sprintf('/Users/Figure3/figCI_%d_%d....

13 days ago | 0

| accepted

Answered

Interpolation using scattered query points

I believe the solution you point to can be trivially vectorized: load clown ; imagesc(X); colormap gray ; [nx,ny] = size(X) ...

Interpolation using scattered query points

I believe the solution you point to can be trivially vectorized: load clown ; imagesc(X); colormap gray ; [nx,ny] = size(X) ...

14 days ago | 0

| accepted

Answered

Finding max value in intervals

Given your nicely separated peaks, I think you could simply use the 'MinPeakDistance' name-value pair, as was done in this examp...

Finding max value in intervals

Given your nicely separated peaks, I think you could simply use the 'MinPeakDistance' name-value pair, as was done in this examp...

14 days ago | 0