Answered

How to spread elements in a cell based on vector?

For X, I think you want something like X{k} = b12{k}(find(idx,1,'first')+2:end); The following code vectorizes the whole...

How to spread elements in a cell based on vector?

For X, I think you want something like X{k} = b12{k}(find(idx,1,'first')+2:end); The following code vectorizes the whole...

13 days ago | 0

| accepted

Answered

How can I convert .p files prior to MATLAB 7.5 into the ones from the following version

It is not possible to "upgrade" p-code. Possible alternatives are to contact the author, to see if they have a newer version, or...

How can I convert .p files prior to MATLAB 7.5 into the ones from the following version

It is not possible to "upgrade" p-code. Possible alternatives are to contact the author, to see if they have a newer version, or...

15 days ago | 0

| accepted

Answered

hey guys o have question about log ...

You can get the base-5 log of a number _x_ as follows log(x)/log(5) A simple explanation of why this works can be found ...

hey guys o have question about log ...

You can get the base-5 log of a number _x_ as follows log(x)/log(5) A simple explanation of why this works can be found ...

18 days ago | 1

| accepted

Answered

how i convert r=1.859494566887529 to (18627-sqrt(50225239))/6206

I found <https://stackoverflow.com/questions/34452967/is-there-an-equivalent-to-mathematicas-rootapproximant-function-in-python-...

how i convert r=1.859494566887529 to (18627-sqrt(50225239))/6206

I found <https://stackoverflow.com/questions/34452967/is-there-an-equivalent-to-mathematicas-rootapproximant-function-in-python-...

26 days ago | 0

Answered

check if data are well separated by clustering

The reason that this happens is that there is randomness involved in the initial guess of centroid position. This will lead to d...

check if data are well separated by clustering

The reason that this happens is that there is randomness involved in the initial guess of centroid position. This will lead to d...

30 days ago | 0

Answered

How to use random arrangement for 2 related matrices?

If _C_ is your second matrix, then D = C(Temp); gives you the corresponding elements of C. This seems so simple, thou...

How to use random arrangement for 2 related matrices?

If _C_ is your second matrix, then D = C(Temp); gives you the corresponding elements of C. This seems so simple, thou...

1 month ago | 0

Answered

How to calculate regression with dummy variables?

If you have the Statistics and Machine Learning Toolbox, take a look at the <https://www.mathworks.com/help/stats/fitlm.html |*f...

How to calculate regression with dummy variables?

If you have the Statistics and Machine Learning Toolbox, take a look at the <https://www.mathworks.com/help/stats/fitlm.html |*f...

1 month ago | 0

| accepted

Answered

Finding minimum value of array with certain property

You can use the <https://www.mathworks.com/help/matlab/ref/find.html |*find*|> command.

Finding minimum value of array with certain property

You can use the <https://www.mathworks.com/help/matlab/ref/find.html |*find*|> command.

1 month ago | 0

| accepted

Answered

How can I split a number in a vector into smaller components?

y = floor(patentgrantdate/10000); m = floor((patentgrantdate-y*10000)/100); d = patentgrantdate-y*10000-m*100; pate...

How can I split a number in a vector into smaller components?

y = floor(patentgrantdate/10000); m = floor((patentgrantdate-y*10000)/100); d = patentgrantdate-y*10000-m*100; pate...

1 month ago | 0

| accepted

Answered

An "if-loop" and "for-loop" problem

I haven't tried to run your code, but I'm going to guess here that the expressions like range(i) are not doing what you ...

An "if-loop" and "for-loop" problem

I haven't tried to run your code, but I'm going to guess here that the expressions like range(i) are not doing what you ...

2 months ago | 0

| accepted

Answered

I have a 19x256x256 STM image in an array form that I need to transform

Using a cell array, with one element for each matrix, would be a much more sane way to do something like what you are asking for...

I have a 19x256x256 STM image in an array form that I need to transform

Using a cell array, with one element for each matrix, would be a much more sane way to do something like what you are asking for...

2 months ago | 0

| accepted

Answered

I am attempting a K means cluster and so far, when I run this program, nothing is showing up on my graph. Can someone help me out?

Let's start with the simplest possibility ... Do you realize that your code does not have a line in it that will _plot_ the c...

I am attempting a K means cluster and so far, when I run this program, nothing is showing up on my graph. Can someone help me out?

Let's start with the simplest possibility ... Do you realize that your code does not have a line in it that will _plot_ the c...

3 months ago | 0

| accepted

Answered

How to plot vectors of different lengths to visualize data?

See my answer to a very similar question <https://www.mathworks.com/matlabcentral/answers/401771-hi-how-to-plot-vectors-with-dif...

How to plot vectors of different lengths to visualize data?

See my answer to a very similar question <https://www.mathworks.com/matlabcentral/answers/401771-hi-how-to-plot-vectors-with-dif...

3 months ago | 0

Answered

How to suffle rows of specific rows from a matrix

I think this does what you want. I wrote it from more of a didactic than efficiency approach. I imagine there are some efficienc...

How to suffle rows of specific rows from a matrix

I think this does what you want. I wrote it from more of a didactic than efficiency approach. I imagine there are some efficienc...

3 months ago | 0

| accepted

Answered

How to index two vectors according to some condition

I think this does what you want % Case 1 x=[ 1 -3 0 -7 5 7 0]; y=[ 9 -4 8 -9 4 1 8]; % % Case 2 % x=[ 1 -8 ...

How to index two vectors according to some condition

I think this does what you want % Case 1 x=[ 1 -3 0 -7 5 7 0]; y=[ 9 -4 8 -9 4 1 8]; % % Case 2 % x=[ 1 -8 ...

3 months ago | 0

| accepted

Answered

How to save a histogram generated with imhist() function as a png image?

You should be able to use the <https://www.mathworks.com/help/matlab/ref/print.html |*print*|> command to save the figure to PNG...

How to save a histogram generated with imhist() function as a png image?

You should be able to use the <https://www.mathworks.com/help/matlab/ref/print.html |*print*|> command to save the figure to PNG...

3 months ago | 0

Answered

Index exceeds matrix dimensions error

I am guessing that the variable _w_ does not exist until you create it using the line w(1)=w_o; Therefore, _w_ is a vect...

Index exceeds matrix dimensions error

I am guessing that the variable _w_ does not exist until you create it using the line w(1)=w_o; Therefore, _w_ is a vect...

3 months ago | 0

Answered

is the mean function broken in R2014b

You probably created a variable named _mean_, and are accidentally trying to access that variable. I suggest either doing ...

is the mean function broken in R2014b

You probably created a variable named _mean_, and are accidentally trying to access that variable. I suggest either doing ...

3 months ago | 1

| accepted

Answered

My cell array has 861 rows and each row has vectors of varying sizes. I want to calculate std dev only for cells that have 20 elements. Others should give a value of 0. How do I tell cellfun to get only the cells with 20 elements. Here is my attempt

ratios = {rand(19,1); rand(20,1); rand(21,1)} cellfun(@(x)std(x)*(numel(x)==20),ratios)

My cell array has 861 rows and each row has vectors of varying sizes. I want to calculate std dev only for cells that have 20 elements. Others should give a value of 0. How do I tell cellfun to get only the cells with 20 elements. Here is my attempt

ratios = {rand(19,1); rand(20,1); rand(21,1)} cellfun(@(x)std(x)*(numel(x)==20),ratios)

3 months ago | 0

| accepted

Answered

What is algorithm used in rangesearch function in matlab

There are typically two places to look for algorithm references for MATLAB function: # The documentation page for that functi...

What is algorithm used in rangesearch function in matlab

There are typically two places to look for algorithm references for MATLAB function: # The documentation page for that functi...

3 months ago | 0

Answered

Hi,How to plot vectors with different sizes against each other ? size of one vector is 24244x1 and other vector is 24243x1

The correct way to do this depends on how the two vectors relate to each other. Take a smaller example. Suppose my two vectors a...

Hi,How to plot vectors with different sizes against each other ? size of one vector is 24244x1 and other vector is 24243x1

The correct way to do this depends on how the two vectors relate to each other. Take a smaller example. Suppose my two vectors a...

3 months ago | 1

Answered

max repetitive values in a vector

I think this does what you want A= [ 2 3 3 4; 4 4 3 6; 5 3 3 9; 2 4 3 8; 8 3 3 12; ...

max repetitive values in a vector

I think this does what you want A= [ 2 3 3 4; 4 4 3 6; 5 3 3 9; 2 4 3 8; 8 3 3 12; ...

3 months ago | 1

| accepted

Answered

Example file from Mathworks does not exist

Do you have the <https://www.mathworks.com/help/audio/index.html Audio System Toolbox> installed? Type <https://www.mathworks...

Example file from Mathworks does not exist

Do you have the <https://www.mathworks.com/help/audio/index.html Audio System Toolbox> installed? Type <https://www.mathworks...

3 months ago | 0

Answered

Creating points inside polygon boundary?

I would use the <https://en.wikipedia.org/wiki/Rejection_sampling rejection method>. Define a square that encloses the entire po...

Creating points inside polygon boundary?

I would use the <https://en.wikipedia.org/wiki/Rejection_sampling rejection method>. Define a square that encloses the entire po...

3 months ago | 1

Answered

How to find the inverse of a 2x2 matrix using gaussian elimination (not using rref or lu)?

I found <https://www.mathworks.com/matlabcentral/answers/130593-hi-am-working-on-a-code-for-gaussian-elimination this answer> by...

How to find the inverse of a 2x2 matrix using gaussian elimination (not using rref or lu)?

I found <https://www.mathworks.com/matlabcentral/answers/130593-hi-am-working-on-a-code-for-gaussian-elimination this answer> by...

3 months ago | 0

Answered

This code is working but in every run i am getting different value of x(1),x(2) and x(3)..kindly solve this problem...its very urgent

Simulated annealing uses randomness as part of the algorithm. If you set the random seed before this code, for example with the ...

This code is working but in every run i am getting different value of x(1),x(2) and x(3)..kindly solve this problem...its very urgent

Simulated annealing uses randomness as part of the algorithm. If you set the random seed before this code, for example with the ...

3 months ago | 0

Answered

Add command disponible in Matlab2017b in my matlab2017a?

I would <https://www.mathworks.com/support/contact_us.html contact support> directly about this.

Add command disponible in Matlab2017b in my matlab2017a?

I would <https://www.mathworks.com/support/contact_us.html contact support> directly about this.

3 months ago | 0

Answered

How to find the efficiency of a function?

I'm not what you mean by "efficiency". Do you mean the time the program (or specific lines) take to execute? If so, then take a ...

How to find the efficiency of a function?

I'm not what you mean by "efficiency". Do you mean the time the program (or specific lines) take to execute? If so, then take a ...

3 months ago | 0

Answered

Why the function rainflow doesn't work in my MatlabR2017?

According to <https://www.mathworks.com/help/signal/ref/rainflow.html the documentation page for |*rainflow*|>, this command was...

Why the function rainflow doesn't work in my MatlabR2017?

According to <https://www.mathworks.com/help/signal/ref/rainflow.html the documentation page for |*rainflow*|>, this command was...

3 months ago | 0

| accepted

Answered

Is it possible to incorporate a hyperlink within a string array that references a specific variable while in a for loop

I haven't figured out what you were trying to do with the breaks, but the core functionality works if you use this: descrip...

Is it possible to incorporate a hyperlink within a string array that references a specific variable while in a for loop

I haven't figured out what you were trying to do with the breaks, but the core functionality works if you use this: descrip...

3 months ago | 0