Answered

Save a double array to a text file

Regardless of what is displayed to the MATLAB command window (in your case, the default format, it seems), an array of type doub...

Save a double array to a text file

Regardless of what is displayed to the MATLAB command window (in your case, the default format, it seems), an array of type doub...

18 days ago | 0

Answered

Doubt in a product erro

The reason has to do with the accuracy of floating-point math on a binary computer. I suggest you read this question and answer,...

Doubt in a product erro

The reason has to do with the accuracy of floating-point math on a binary computer. I suggest you read this question and answer,...

19 days ago | 1

Answered

How to only show part of a plot

You can set the axis limits of a plot using the xlim (and ylim and zlim) command. If that is not what you meant, I suggest you ...

How to only show part of a plot

You can set the axis limits of a plot using the xlim (and ylim and zlim) command. If that is not what you meant, I suggest you ...

20 days ago | 0

Answered

using logical functions to display arrays

When x is a vector, then if x < 10 is interpreted as "if all elements of x are less than 10". Your if statement is never enter...

using logical functions to display arrays

When x is a vector, then if x < 10 is interpreted as "if all elements of x are less than 10". Your if statement is never enter...

20 days ago | 0

Answered

Cody Problem 14. Find the numeric mean of the prime numbers in a matrix.

After you correct the problem that @Geoff Hayes pointed out in his comment, you still have a mathematical one. out = sum/2 is ...

Cody Problem 14. Find the numeric mean of the prime numbers in a matrix.

After you correct the problem that @Geoff Hayes pointed out in his comment, you still have a mathematical one. out = sum/2 is ...

22 days ago | 0

Answered

Simpsons rule function error

In this line of code: x=x(1)+h*(2*k-1); you have set x to a scalar value, so when you try to access x(2) in this line of code:...

Simpsons rule function error

In this line of code: x=x(1)+h*(2*k-1); you have set x to a scalar value, so when you try to access x(2) in this line of code:...

23 days ago | 1

| accepted

Answered

What Shall I need to add while calling file having numerical digits (e.g. -1,-2)?

You may want to try the functional form instead. load('Histories/IND.X0kY-1k.CXY.sema'); Also, what variables are in your work...

What Shall I need to add while calling file having numerical digits (e.g. -1,-2)?

You may want to try the functional form instead. load('Histories/IND.X0kY-1k.CXY.sema'); Also, what variables are in your work...

24 days ago | 0

Answered

clustering based on a custom function

I can't say that I have spent enough time with your code to fully understand it. But, I notice the following. Inside the loop o...

clustering based on a custom function

I can't say that I have spent enough time with your code to fully understand it. But, I notice the following. Inside the loop o...

25 days ago | 0

| accepted

Answered

data from one array to another

I can't tell what you intend to get from this expression [x(j),:] which is not valid MATLAB syntax. x(j) is the j-th element o...

data from one array to another

I can't tell what you intend to get from this expression [x(j),:] which is not valid MATLAB syntax. x(j) is the j-th element o...

26 days ago | 0

Answered

How do i get three colums as output?

t = data(:,[93,92,91]); will be the the last three columns from data, in reverse order.

How do i get three colums as output?

t = data(:,[93,92,91]); will be the the last three columns from data, in reverse order.

27 days ago | 1

| accepted

Answered

Placing none NaN values from a matrix to another

A = [NaN NaN NaN 3 0 NaN NaN 1; NaN 2 NaN 6 1 NaN NaN NaN; 5 NaN NaN 2 NaN NaN NaN 1]; B = [ 1 2 3 4 5 6 7 8; 8 7 6 5 4 3 2 1; ...

Placing none NaN values from a matrix to another

A = [NaN NaN NaN 3 0 NaN NaN 1; NaN 2 NaN 6 1 NaN NaN NaN; 5 NaN NaN 2 NaN NaN NaN 1]; B = [ 1 2 3 4 5 6 7 8; 8 7 6 5 4 3 2 1; ...

27 days ago | 0

| accepted

Answered

why i get Array indices must be positive integers or logical values.

In this line z(length(R),length(R)-1) = -R(length(R)-1) if the user enters a resistance vector that is length 1, then you try...

why i get Array indices must be positive integers or logical values.

In this line z(length(R),length(R)-1) = -R(length(R)-1) if the user enters a resistance vector that is length 1, then you try...

27 days ago | 0

| accepted

Answered

Error in code, "Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses. "

You seem to have a rogue t at the end of your expression. If you get rid of that, then ... Td=1/55*(20*pi*sin(1/11*pi*t)+33*exp...

Error in code, "Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses. "

You seem to have a rogue t at the end of your expression. If you get rid of that, then ... Td=1/55*(20*pi*sin(1/11*pi*t)+33*exp...

27 days ago | 0

Answered

Replacing single values in a matrix with 1x09 doubles

I think this does what you want, using a straightforward loop. You could loop this over values of N = 1:6, if what you want to ...

Replacing single values in a matrix with 1x09 doubles

I think this does what you want, using a straightforward loop. You could loop this over values of N = 1:6, if what you want to ...

29 days ago | 1

| accepted

Answered

Unable to perform assignment because the left and right sides have a different number of element

You need to use K(n,:)=A; and L(n,:)=A; to assign the row vector A to a row of K or L. K(n) is a single element, using line...

Unable to perform assignment because the left and right sides have a different number of element

You need to use K(n,:)=A; and L(n,:)=A; to assign the row vector A to a row of K or L. K(n) is a single element, using line...

1 month ago | 1

Answered

un-mix a pdf

I was doing a bit of searching on this forum, and I found this question, where @Image Analyst uploaded his Fit Multiple Gaussian...

un-mix a pdf

I was doing a bit of searching on this forum, and I found this question, where @Image Analyst uploaded his Fit Multiple Gaussian...

1 month ago | 0

Answered

Index exceeds the number of array elements

You have defined C_target as a scalar (i.e. a single value), but you try to access it in the for loop with C_target(i) so when...

Index exceeds the number of array elements

You have defined C_target as a scalar (i.e. a single value), but you try to access it in the for loop with C_target(i) so when...

1 month ago | 0

Answered

Finding sorted rows in a matrix

For my current understanding of what you want, I believe this works: ii = find(diff(outsx,[],2)>=0)

Finding sorted rows in a matrix

For my current understanding of what you want, I believe this works: ii = find(diff(outsx,[],2)>=0)

1 month ago | 1

Answered

Finding sorted rows in a matrix

outsx = [ 1 1 2 1 3 1 1 2 2 2 3 2 1 3 2 3 ...

Finding sorted rows in a matrix

outsx = [ 1 1 2 1 3 1 1 2 2 2 3 2 1 3 2 3 ...

1 month ago | 0

Answered

Will MATLAB function samplesizepwr work with paired t-test

I read through the documentation, and I don't see any mention of calculating power for a paired t-test. Maybe there is a way, bu...

Will MATLAB function samplesizepwr work with paired t-test

I read through the documentation, and I don't see any mention of calculating power for a paired t-test. Maybe there is a way, bu...

1 month ago | 1

Answered

place different sets of columns into a matrix

As you can see below, what you tried will work. N = 400; A = rand(N,5); B = rand(N,5); C = rand(N,5); D = rand(N,5); a...

place different sets of columns into a matrix

As you can see below, what you tried will work. N = 400; A = rand(N,5); B = rand(N,5); C = rand(N,5); D = rand(N,5); a...

1 month ago | 0

Answered

Fitting Cumulative Gaussian Function to data

I get the same coefficient that you did, using the fitnlm function instead. This seems to be a terrible model for your data, wh...

Fitting Cumulative Gaussian Function to data

I get the same coefficient that you did, using the fitnlm function instead. This seems to be a terrible model for your data, wh...

1 month ago | 0

| accepted

Answered

how to prompt a user to enter a string, then check that the entered string is one of the acceptable entries. If it is not, user must enter it again.

I think this is what you intended ... unit = input('TEXT PROMPTING USER TO INPUT UNITS (EXAMPLE OF ACCEPTED UNITS (unit q, unit...

how to prompt a user to enter a string, then check that the entered string is one of the acceptable entries. If it is not, user must enter it again.

I think this is what you intended ... unit = input('TEXT PROMPTING USER TO INPUT UNITS (EXAMPLE OF ACCEPTED UNITS (unit q, unit...

1 month ago | 1

| accepted

Answered

How can I join two vectors?

It seems that you just got the dimension wrong. Down the column is dimension 1: a = [2; 3; 5]; % col vector b = [7; 11; 13]; %...

How can I join two vectors?

It seems that you just got the dimension wrong. Down the column is dimension 1: a = [2; 3; 5]; % col vector b = [7; 11; 13]; %...

1 month ago | 0

| accepted

Answered

Add header to array

Disclaimer: I have not tried to do this myself. I suggest taking a look at this documentation about mapping MATLAB data types t...

Add header to array

Disclaimer: I have not tried to do this myself. I suggest taking a look at this documentation about mapping MATLAB data types t...

1 month ago | 0

Answered

Gaussian Mixture Model cluster order

I think you'll need a bit of programming to do that. Specifically, fitgmdist will output a model object, and the model object wi...

Gaussian Mixture Model cluster order

I think you'll need a bit of programming to do that. Specifically, fitgmdist will output a model object, and the model object wi...

1 month ago | 0

| accepted

Answered

Error in using prctile, not enough input arguments.

This line is confusing to me, and is likely where the problem is: minPeak = prctile(Q(:,i),prctile); You are trying to use prc...

Error in using prctile, not enough input arguments.

This line is confusing to me, and is likely where the problem is: minPeak = prctile(Q(:,i),prctile); You are trying to use prc...

1 month ago | 1

Answered

MATLAB ploting graph incorrectly, different from same code in Python.

In your definition of r, you missed a couple spots that required array operations instead of matrix operations: %Pressure P = ...

MATLAB ploting graph incorrectly, different from same code in Python.

In your definition of r, you missed a couple spots that required array operations instead of matrix operations: %Pressure P = ...

1 month ago | 0

| accepted

Answered

Lettering a Bar Chart

Here is one way, closely based on yours: yData = [10, 25,15,10,25,20]; myFig = gcf; myAx = axes(myFig); ...

Lettering a Bar Chart

Here is one way, closely based on yours: yData = [10, 25,15,10,25,20]; myFig = gcf; myAx = axes(myFig); ...

1 month ago | 1

| accepted

Answered

How can I plot an histogram with bar chart that have striped filling?

Here is a very old post about how to do this. I don't know if there is something newer or better.

How can I plot an histogram with bar chart that have striped filling?

Here is a very old post about how to do this. I don't know if there is something newer or better.

1 month ago | 0