Answered

How to use cellstr() without losing whitespace character?

Wanted = num2cell(your_char_array,2)

How to use cellstr() without losing whitespace character?

Wanted = num2cell(your_char_array,2)

5 meses ago | 1

Answered

how to plot cell array

I don’t why you’re saying multidimensional cell array all I see in the picture is a cell array containing character array. ...

how to plot cell array

I don’t why you’re saying multidimensional cell array all I see in the picture is a cell array containing character array. ...

5 meses ago | 0

| accepted

Answered

Store values from a for loop into a matrix

RARmat = zeros(65, 3) for ii = 1:65 RARatio = AUC/RA; disp(RARatio) % RAR Matrix RARmat(ii, :) ...

Store values from a for loop into a matrix

RARmat = zeros(65, 3) for ii = 1:65 RARatio = AUC/RA; disp(RARatio) % RAR Matrix RARmat(ii, :) ...

5 meses ago | 0

| accepted

Answered

Creating a MatLab code to convert numerical grades into letter grades.

You should loop through mn and save the results as a cell array in a variable which is preallocated before loop using indexing. ...

Creating a MatLab code to convert numerical grades into letter grades.

You should loop through mn and save the results as a cell array in a variable which is preallocated before loop using indexing. ...

5 meses ago | 0

Answered

How can I deleate or replace with a 0 all the Nan, Inf anf -Inf values in a time series from the biggining to the end?

a(isinf(a)|isnan(a))=0 % replaces with zero

How can I deleate or replace with a 0 all the Nan, Inf anf -Inf values in a time series from the biggining to the end?

a(isinf(a)|isnan(a))=0 % replaces with zero

5 meses ago | 0

Answered

Showing error Matrix dimensions must agree

theta =0:2*pi:100; r=linspace(0,100,numel(theta)); % theta and r should have same length/ or either one be a scalar z=2*(r-4*...

Showing error Matrix dimensions must agree

theta =0:2*pi:100; r=linspace(0,100,numel(theta)); % theta and r should have same length/ or either one be a scalar z=2*(r-4*...

5 meses ago | 0

Answered

how to find how many elements are there in a cell of an array?

No_of_elements = cellfun(@numel, cells)

how to find how many elements are there in a cell of an array?

No_of_elements = cellfun(@numel, cells)

5 meses ago | 0

| accepted

Answered

Assign values of a result to an input variable.

That’s not a good idea, see https://in.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dyn...

Assign values of a result to an input variable.

That’s not a good idea, see https://in.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dyn...

5 meses ago | 0

| accepted

Answered

I keep getting a 'parse error' at '='

Change arctan() to *atan()* and y=0 to *y==0*. doc if

I keep getting a 'parse error' at '='

Change arctan() to *atan()* and y=0 to *y==0*. doc if

5 meses ago | 0

| accepted

Answered

Create a 34 element column vector, PiVec, where every element is the irrational number pi

Use those commands and add/multiply with which number you want the elements to be. doc ones doc zeros

Create a 34 element column vector, PiVec, where every element is the irrational number pi

Use those commands and add/multiply with which number you want the elements to be. doc ones doc zeros

5 meses ago | 0

Answered

how to convert answer to one single number

f = @(x) 2.048*exp(-((x-5.056)/0.2349).^2) +... 1.089*exp(-((x-4.887)/0.4006).^2) +... 0.4116*exp(-((x-9.103)/5.731).^...

how to convert answer to one single number

f = @(x) 2.048*exp(-((x-5.056)/0.2349).^2) +... 1.089*exp(-((x-4.887)/0.4006).^2) +... 0.4116*exp(-((x-9.103)/5.731).^...

5 meses ago | 0

| accepted

Answered

How to store the results from a for loop into a matrix?

F = 2; x = .1:.05:1.9; Reactions = cell(numel(x),1); b = [0 F 0 F/2 0 0 0 0 0 0]'; % there's no point in defining it over an...

How to store the results from a for loop into a matrix?

F = 2; x = .1:.05:1.9; Reactions = cell(numel(x),1); b = [0 F 0 F/2 0 0 0 0 0 0]'; % there's no point in defining it over an...

5 meses ago | 0

Answered

Array indices must be positive integers or logical values

beta Operator missing here ( M Note: Don’t name a variable beta because there is an inbuilt function named *beta()*. Prealloc...

Array indices must be positive integers or logical values

beta Operator missing here ( M Note: Don’t name a variable beta because there is an inbuilt function named *beta()*. Prealloc...

5 meses ago | 0

Answered

insert zero in chosen column of matrix randomly

ix = 1:2:size(A,1); A(ix(randi(numel(ix),1)),3)=0

insert zero in chosen column of matrix randomly

ix = 1:2:size(A,1); A(ix(randi(numel(ix),1)),3)=0

5 meses ago | 0

| accepted

Answered

Possible matlab bug with text() function?

When you name variable as the same name as the function this happens. clear text plot sin % not sure which function you’re...

Possible matlab bug with text() function?

When you name variable as the same name as the function this happens. clear text plot sin % not sure which function you’re...

5 meses ago | 0

| accepted

Answered

Swapping the columns based on matrix even length

No matter odd or even: ix=(2:2:size(matrix,2)) + [0;-1]; % if > 2016b ix = bsxfun(@plus, 2:2:size(a,2), [0;-1]) Wanted = matr...

Swapping the columns based on matrix even length

No matter odd or even: ix=(2:2:size(matrix,2)) + [0;-1]; % if > 2016b ix = bsxfun(@plus, 2:2:size(a,2), [0;-1]) Wanted = matr...

5 meses ago | 1

Answered

how to make a legend for a single point

h=plot(i,Cm_1212_voigt,'.g') % inside loop legend(h,'Points') % outside loop

how to make a legend for a single point

h=plot(i,Cm_1212_voigt,'.g') % inside loop legend(h,'Points') % outside loop

5 meses ago | 0

| accepted

Answered

Delete rows in intervall

An another alternative: ix = (5:7:size(TABLE,1)) + [0;1;2]; %if > 2016b ix = bsxfun(@plus, 5:7:size(TABLE,1), [0;1;2]) TABLE...

Delete rows in intervall

An another alternative: ix = (5:7:size(TABLE,1)) + [0;1;2]; %if > 2016b ix = bsxfun(@plus, 5:7:size(TABLE,1), [0;1;2]) TABLE...

5 meses ago | 0

| accepted

Answered

How can I take a mean of a matrix only from 10 first rows?

>> X = rand(50000,3); % are you sure it's a 50000 by 3 matrix? >> mean(X(1:5000,:)) ans = 0.5028 0.5015 0.4978 ...

How can I take a mean of a matrix only from 10 first rows?

>> X = rand(50000,3); % are you sure it's a 50000 by 3 matrix? >> mean(X(1:5000,:)) ans = 0.5028 0.5015 0.4978 ...

5 meses ago | 0

Answered

logical array variables in a loop

It would been simpler if they were stored in a cell array: c{1} = outlier & incl_p; c{2}= outlier & incl_r; c{3} = ou...

logical array variables in a loop

It would been simpler if they were stored in a cell array: c{1} = outlier & incl_p; c{2}= outlier & incl_r; c{3} = ou...

5 meses ago | 1

| accepted

Answered

How can i get sub matrices with using for loop

a=arrayfun(@(x)A(A==unique(x)),A,'un',0) celldisp(a) If you’re goal is simply to create A with repetitions of 10 then it...

How can i get sub matrices with using for loop

a=arrayfun(@(x)A(A==unique(x)),A,'un',0) celldisp(a) If you’re goal is simply to create A with repetitions of 10 then it...

5 meses ago | 0

Answered

How to count the number of repeat elements in a matrix

M =["Fa" "Fa" "Fa" "Fa" "Ka" "Ka"]; [~,~,c] = unique(M); A = accumarray(c,1)

How to count the number of repeat elements in a matrix

M =["Fa" "Fa" "Fa" "Fa" "Ka" "Ka"]; [~,~,c] = unique(M); A = accumarray(c,1)

5 meses ago | 0

| accepted

Answered

Create a matrix from a vector

A = ismember(M,V) .* M % Note: 14 should be in 1,1 not 2,1

Create a matrix from a vector

A = ismember(M,V) .* M % Note: 14 should be in 1,1 not 2,1

5 meses ago | 0

| accepted

Answered

Creating a table for publishing for the matrix I defined

TABle = table(T(:),C_vv(:),'VariableNames',{'Temperature','Heat'}) % I don’t know what you mean by naming columns isn’t that V...

Creating a table for publishing for the matrix I defined

TABle = table(T(:),C_vv(:),'VariableNames',{'Temperature','Heat'}) % I don’t know what you mean by naming columns isn’t that V...

5 meses ago | 0

| accepted