3 053 total contributions since 2018

Communication through MATLAB is always better than arguing.

Answered

Removing NaNs columns in matrices within cell array

nonancellA = cellfun(@(m) m(:,~any(isnan(m),1)), X, 'UniformOutput', false)

Removing NaNs columns in matrices within cell array

nonancellA = cellfun(@(m) m(:,~any(isnan(m),1)), X, 'UniformOutput', false)

environ 9 heures ago | 0

| accepted

Answered

Finding the index of spesific element in a matrix?

Assuming you want to index of the last match in the matrix: Index=find(a==3,1,'last') <https://in.mathworks.com/company/...

Finding the index of spesific element in a matrix?

Assuming you want to index of the last match in the matrix: Index=find(a==3,1,'last') <https://in.mathworks.com/company/...

environ 9 heures ago | 1

| accepted

Answered

Index exceeds the number of array elements (100001)

for k = 1:numel(z)-1

Index exceeds the number of array elements (100001)

for k = 1:numel(z)-1

environ 12 heures ago | 0

Answered

How to read specific data from a text file

Simpler: S=fileread(filename); sscanf(S,'Station %f N %f')

How to read specific data from a text file

Simpler: S=fileread(filename); sscanf(S,'Station %f N %f')

environ 14 heures ago | 1

Answered

multiply table and matrix

I prefer Adam's method : although if you want to multiply table with matrix then=> arrayfun(@(x) A{:,x}*B(x),1:numel(B),'un',0...

multiply table and matrix

I prefer Adam's method : although if you want to multiply table with matrix then=> arrayfun(@(x) A{:,x}*B(x),1:numel(B),'un',0...

environ 15 heures ago | 1

| accepted

Answered

Find cell with nearest value

C = [yourcell{:}]; % assuming each cell contains a scalar [Value,Where] = min(C(C>0 & C<1))

Find cell with nearest value

C = [yourcell{:}]; % assuming each cell contains a scalar [Value,Where] = min(C(C>0 & C<1))

environ 15 heures ago | 0

| accepted

Answered

Split Table at certain rows with for loop

v=[1 500 900 1200]; % ^--appended 1 at the beginning Splittable=cell(numel(v)-1,1); for k=2:numel(v) Splittable{k-1}=T...

Split Table at certain rows with for loop

v=[1 500 900 1200]; % ^--appended 1 at the beginning Splittable=cell(numel(v)-1,1); for k=2:numel(v) Splittable{k-1}=T...

environ 15 heures ago | 1

| accepted

Answered

Combining multiple plots in 1 graph

Read this once again: Use hold on after the first plot() call and indeed remove subplot()

Combining multiple plots in 1 graph

Read this once again: Use hold on after the first plot() call and indeed remove subplot()

environ 22 heures ago | 0

Answered

simple structure problem (return field name)

Since it's your assignment: 1) Use arrayfun() for Sight using sum() assuming the max sum is the best Sight. 2) max() the resul...

simple structure problem (return field name)

Since it's your assignment: 1) Use arrayfun() for Sight using sum() assuming the max sum is the best Sight. 2) max() the resul...

environ 23 heures ago | 0

Answered

Why must have brackets around 'student'?

https://in.mathworks.com/help/matlab/matlab_prog/generate-field-names-from-variables.html - this is why

Why must have brackets around 'student'?

https://in.mathworks.com/help/matlab/matlab_prog/generate-field-names-from-variables.html - this is why

environ 23 heures ago | 1

| accepted

Answered

How to check if cell has particular value or not?

contains() - if it contains "NaN" a string isnan() - if it contains NaN value

How to check if cell has particular value or not?

contains() - if it contains "NaN" a string isnan() - if it contains NaN value

1 jour ago | 1

| accepted

Answered

XMIN must be a floating point scalar when xmin is from vpasolve

They are of symbolic type to convert them use double() : xmax=double(solx(3)); xmin=double(solx(4));

XMIN must be a floating point scalar when xmin is from vpasolve

They are of symbolic type to convert them use double() : xmax=double(solx(3)); xmin=double(solx(4));

1 jour ago | 1

| accepted

Answered

find a max value in function

Add the below after mesh() call: mx = z==max(z(:)); mn = z==min(z(:)); hold on plot3(x(mx),y(mx),z(mx),'ok') plot3(x(mn),y(...

find a max value in function

Add the below after mesh() call: mx = z==max(z(:)); mn = z==min(z(:)); hold on plot3(x(mx),y(mx),z(mx),'ok') plot3(x(mn),y(...

1 jour ago | 0

| accepted

Answered

How can i find properties of value that coming from which array&cell?

Use the second output of *max() & min()*

How can i find properties of value that coming from which array&cell?

Use the second output of *max() & min()*

2 jours ago | 0

| accepted

Answered

Vector inside another vector

People don’t do homeworks here. Index K>=S to U1 lhs and S rhs by equating against each other. Since it’s your homework see Alex...

Vector inside another vector

People don’t do homeworks here. Index K>=S to U1 lhs and S rhs by equating against each other. Since it’s your homework see Alex...

2 jours ago | 0

Answered

how do i generate conditional random number either 0 or 1 ?

adj_mtr(dist_mtr > 0 & dist_mtr <= 2*r) = randi([0, 1],1,nnz(dist_mtr > 0 & dist_mtr <= 2*r));

how do i generate conditional random number either 0 or 1 ?

adj_mtr(dist_mtr > 0 & dist_mtr <= 2*r) = randi([0, 1],1,nnz(dist_mtr > 0 & dist_mtr <= 2*r));

3 jours ago | 0

Answered

How do I write matrix function with symbolic expression

Since it’s your homework: <https://in.mathworks.com/help/symbolic/solve.html#bup_5dp-1>

How do I write matrix function with symbolic expression

Since it’s your homework: <https://in.mathworks.com/help/symbolic/solve.html#bup_5dp-1>

4 jours ago | 0

Answered

MATLAB Answers Wish-list #4 (and bug reports)

Sometimes deleting answer after moving is impossible for instance the below thread: https://in.mathworks.com/matlabcentral/answ...

MATLAB Answers Wish-list #4 (and bug reports)

Sometimes deleting answer after moving is impossible for instance the below thread: https://in.mathworks.com/matlabcentral/answ...

4 jours ago | 0

Answered

why is my code not working?

Probably you want (no loops needed): ii = linspace(0.0001,0.0009,1000); Fm = (0.25).*(((log((2.7*10^-5)+... (2.51.*((Rey....

why is my code not working?

Probably you want (no loops needed): ii = linspace(0.0001,0.0009,1000); Fm = (0.25).*(((log((2.7*10^-5)+... (2.51.*((Rey....

5 jours ago | 1

Answered

Hi , i have a matrix and need to extract the column in this way , thank you

idx= [ 1 5 9 13 ]; A(:,idx) % 4 X 4 A(:,setdiff(1:size(A,2),idx)) % 4 X 12

Hi , i have a matrix and need to extract the column in this way , thank you

idx= [ 1 5 9 13 ]; A(:,idx) % 4 X 4 A(:,setdiff(1:size(A,2),idx)) % 4 X 12

5 jours ago | 0

| accepted

Answered

Having trouble to solve equations

Use fsolve(): E=1.42; F=@(x)[((E+x(1))*0.1+(-x(2)-7*x(3))*(((E+x(1))*(E+x(1))*(E+x(1))*(E+x(1)))/(((E+x(1))*(E+x(1))*(E+x(1))...

Having trouble to solve equations

Use fsolve(): E=1.42; F=@(x)[((E+x(1))*0.1+(-x(2)-7*x(3))*(((E+x(1))*(E+x(1))*(E+x(1))*(E+x(1)))/(((E+x(1))*(E+x(1))*(E+x(1))...

5 jours ago | 1

| accepted

Answered

i am not getting correct output.please help

e = eccentricity(1,2) % function call function e = eccentricity(a,b) % function definition , a & b assumed as scalars for thi...

i am not getting correct output.please help

e = eccentricity(1,2) % function call function e = eccentricity(a,b) % function definition , a & b assumed as scalars for thi...

5 jours ago | 1

| accepted

Answered

Why am I not getting the plot results?

Because you missed the dot operators: https://in.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html The bel...

Why am I not getting the plot results?

Because you missed the dot operators: https://in.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html The bel...

5 jours ago | 1

| accepted

Answered

sorted two different arrays

[~,idx]=sort(T{:,1}); % T your table C(idx,:) % C your cell become sorted according to first column of table T(idx,:) ...

sorted two different arrays

[~,idx]=sort(T{:,1}); % T your table C(idx,:) % C your cell become sorted according to first column of table T(idx,:) ...

5 jours ago | 1

| accepted

Answered

Am getting the error ' Array indices must be positive integers or logical values.

xander = 1/n * h1 * (sum(kiki * (([m{:}] - numel(Test)/h1)))); % ^ missed

Am getting the error ' Array indices must be positive integers or logical values.

xander = 1/n * h1 * (sum(kiki * (([m{:}] - numel(Test)/h1)))); % ^ missed

6 jours ago | 0

| accepted

Answered

Is the following sample mean and variance fully vectorised?

MATLAB already has inbuilt functions named <https://in.mathworks.com/help/matlab/ref/mean.html *mean()*> and <https://in.mathwor...

Is the following sample mean and variance fully vectorised?

MATLAB already has inbuilt functions named <https://in.mathworks.com/help/matlab/ref/mean.html *mean()*> and <https://in.mathwor...

6 jours ago | 0