3,060 total contributions since 2018

Communication through MATLAB is always better than arguing.

Answered

I need to write a function that accepts matrix as input and returns a square matrix

So basically we would suggest like this for homeworks: help size help logical help function https://matlabacademy.mathworks....

I need to write a function that accepts matrix as input and returns a square matrix

So basically we would suggest like this for homeworks: help size help logical help function https://matlabacademy.mathworks....

1 day ago | 1

Answered

Matrix value change with conditions (x=y*(mask==1))

(* performs matrix multiplication) perhaps you needed .* element wise multiplication https://in.mathworks.com/help/matlab/matla...

Matrix value change with conditions (x=y*(mask==1))

(* performs matrix multiplication) perhaps you needed .* element wise multiplication https://in.mathworks.com/help/matlab/matla...

1 day ago | 1

| accepted

Answered

How can I solve randperm error with words?

[x,y]=ndgrid(Tile); xy=[x(:),y(:)]; xy(~strcmp(xy(:,1),xy(:,2)),:)

How can I solve randperm error with words?

[x,y]=ndgrid(Tile); xy=[x(:),y(:)]; xy(~strcmp(xy(:,1),xy(:,2)),:)

2 days ago | 0

| accepted

Answered

Convert 3-D matrix/table to character string

sprintf('%f ',reshape(threeddata,1,[]))

Convert 3-D matrix/table to character string

sprintf('%f ',reshape(threeddata,1,[]))

2 days ago | 0

Answered

imshow() not working , try a lot times

Read this once again: You have a custom file named image.m please move it from MATLAB's path or rename it.

imshow() not working , try a lot times

Read this once again: You have a custom file named image.m please move it from MATLAB's path or rename it.

2 days ago | 0

| accepted

Answered

How to save results with greek letters for importing into publish command

Z=sprintf('coordinate = %0.2e %s %0.2f %s',... 10,char(8737),pi,char(186)); writetable(table({Z}),'sample.txt',... 'W...

How to save results with greek letters for importing into publish command

Z=sprintf('coordinate = %0.2e %s %0.2f %s',... 10,char(8737),pi,char(186)); writetable(table({Z}),'sample.txt',... 'W...

2 days ago | 0

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)

3 days 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/...

3 days ago | 1

| accepted

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')

3 days 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...

3 days 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))

3 days 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...

3 days 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()

3 days 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...

3 days 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

3 days 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

4 days 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));

4 days 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(...

4 days 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()*

4 days 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...

5 days 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));

5 days 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>

6 days 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...

6 days 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....

7 days 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

7 days 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))...

7 days 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...

7 days ago | 1

| accepted