Answered

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

Whenever a text is edited by mobile [safari browser] , the click produces superfluous three letters " ltr " , which is really fr...

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

Whenever a text is edited by mobile [safari browser] , the click produces superfluous three letters " ltr " , which is really fr...

13 days ago | 0

Answered

Replacing an element in a matrix, then storing it as a different variable name

x2 = x; x2(x2==3) = 4

Replacing an element in a matrix, then storing it as a different variable name

x2 = x; x2(x2==3) = 4

13 days ago | 0

Answered

Comparing two matrix elements summing third and storing them separately

T = array2table(A); t = groupsummary(T,{'A1','A2'},'sum'); x = t{:,[1,2,end]}

Comparing two matrix elements summing third and storing them separately

T = array2table(A); t = groupsummary(T,{'A1','A2'},'sum'); x = t{:,[1,2,end]}

14 days ago | 0

Answered

How to stop matlab from truncating long decimal numbers

The decimals are not truncated it’s just the appearance in command window: doc format doc sprintf

How to stop matlab from truncating long decimal numbers

The decimals are not truncated it’s just the appearance in command window: doc format doc sprintf

14 days ago | 0

Answered

how can remove the rows and columns which has ones in all

use *all()* for columns and rows separately , make a copy of A to B and finally remove the unwanted

how can remove the rows and columns which has ones in all

use *all()* for columns and rows separately , make a copy of A to B and finally remove the unwanted

14 days ago | 0

| accepted

Answered

how to to address a specific cell

Use *find()* to know their indices: doc find

how to to address a specific cell

Use *find()* to know their indices: doc find

14 days ago | 0

Answered

How to replace numbers in a column vector after certain elements?

X(600+1 : end) = 0;

How to replace numbers in a column vector after certain elements?

X(600+1 : end) = 0;

14 days ago | 0

| accepted

Answered

Checking for conditions in Dataset

M = sort(matrix(:,specific_column)); top_5 = M(1:5); top_5_greater_than_50 = sum(top_5) > 50; There_exist = any(matri...

Checking for conditions in Dataset

M = sort(matrix(:,specific_column)); top_5 = M(1:5); top_5_greater_than_50 = sum(top_5) > 50; There_exist = any(matri...

14 days ago | 0

Answered

Saving data from loops

What values are you going to store? The chosen_index is for sure a scalar because as soon as the condition is satisfied once the...

Saving data from loops

What values are you going to store? The chosen_index is for sure a scalar because as soon as the condition is satisfied once the...

15 days ago | 0

Answered

remove Nan from a row vector using if statement only

*isnan()* would suffice your need doc isnan

remove Nan from a row vector using if statement only

*isnan()* would suffice your need doc isnan

15 days ago | 0

| accepted

Answered

Save data from while loop

You don’t need a loop , simply define t as t = 0:dt:100; doc while % to know more about the loop doc for and use element wi...

Save data from while loop

You don’t need a loop , simply define t as t = 0:dt:100; doc while % to know more about the loop doc for and use element wi...

16 days ago | 0

Answered

how to code variable to code

Completely terrible idea see https://in.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-d...

how to code variable to code

Completely terrible idea see https://in.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-d...

18 days ago | 0

Answered

A question related to subs in ode (symbolic maths toolbox)

I am not sure what you are asking for perhaps an example below?: >> syms x y >> eqn = x+2*y eqn = x + 2*y >> subs(...

A question related to subs in ode (symbolic maths toolbox)

I am not sure what you are asking for perhaps an example below?: >> syms x y >> eqn = x+2*y eqn = x + 2*y >> subs(...

18 days ago | 0

| accepted

Answered

How to get row index satisfy the condition in cell array

The last column doesn't seem to be a char: data(cell2mat(data(:,end))==1,:)

How to get row index satisfy the condition in cell array

The last column doesn't seem to be a char: data(cell2mat(data(:,end))==1,:)

21 days ago | 1

| accepted

Answered

Convert Cell to Matrix

As sir Walter mentioned already , you cannot have holes in matrices . So you could replace them with nans perhaps: cell_A(c...

Convert Cell to Matrix

As sir Walter mentioned already , you cannot have holes in matrices . So you could replace them with nans perhaps: cell_A(c...

25 days ago | 0

| accepted

Answered

Scalar Multiplication of different values at same time

Assign the values with one output for instance as variable X which consists all the values in it.

Scalar Multiplication of different values at same time

Assign the values with one output for instance as variable X which consists all the values in it.

25 days ago | 0

Answered

how to fill pre allocated matrix using two columns vectors

% Illustration Matrix = zeros(5); X = (10:10:50).'; % column vectors Y = (40:10:80).'; Matrix(end,:) = X.'; Matrix(:,1) = ...

how to fill pre allocated matrix using two columns vectors

% Illustration Matrix = zeros(5); X = (10:10:50).'; % column vectors Y = (40:10:80).'; Matrix(end,:) = X.'; Matrix(:,1) = ...

25 days ago | 0

Answered

Converting a cell type data to a 4d format

Try this: AA=cellfun(@(x) x.',A,'un',0); Wanted = cat(4,AA{:})

Converting a cell type data to a 4d format

Try this: AA=cellfun(@(x) x.',A,'un',0); Wanted = cat(4,AA{:})

25 days ago | 0

| accepted

Answered

Indexing error when using the plot function.

clear all % you have a variable named plot

Indexing error when using the plot function.

clear all % you have a variable named plot

26 days ago | 2

Answered

How to make a .csv file with data values in .txt

T = readtable('data.txt'); T1 = str2double(table2cell(T)); csvwrite('Wanted.csv',T1(~all(isnan(T1),2),:)) % after this the cs...

How to make a .csv file with data values in .txt

T = readtable('data.txt'); T1 = str2double(table2cell(T)); csvwrite('Wanted.csv',T1(~all(isnan(T1),2),:)) % after this the cs...

26 days ago | 1

Answered

Cell Array with different sizes

"Ich would like to read them seperately now in variables." Terrible idea see https://in.mathworks.com/matlabcentral/answers/3...

Cell Array with different sizes

"Ich would like to read them seperately now in variables." Terrible idea see https://in.mathworks.com/matlabcentral/answers/3...

27 days ago | 0

| accepted

Answered

How can I get the X and Y coordinates from an fplot graph? or from a function by parts?

h = fplot(mfinalres,[0,20]); x1 = h.XData y1 = y.YData

How can I get the X and Y coordinates from an fplot graph? or from a function by parts?

h = fplot(mfinalres,[0,20]); x1 = h.XData y1 = y.YData

27 days ago | 0

| accepted

Answered

How to assign only first member in matrix

q(t) = find(A == max1(t),1,'first')

How to assign only first member in matrix

q(t) = find(A == max1(t),1,'first')

27 days ago | 0

| accepted

Answered

How to randomly and uniquely select 2000 samples from an array with 1x460800.

val(randperm(numel(val),2000))

How to randomly and uniquely select 2000 samples from an array with 1x460800.

val(randperm(numel(val),2000))

27 days ago | 1

| accepted

Answered

ode45 or dsolve

tspan=[0 4]; y0=[0.02;0]; m=5; k=1000; c=1000; [t,y]=ode45(@(t,y)unforced1(t,y,c,m,k),tspan,y0); % function call plot(t,y(...

ode45 or dsolve

tspan=[0 4]; y0=[0.02;0]; m=5; k=1000; c=1000; [t,y]=ode45(@(t,y)unforced1(t,y,c,m,k),tspan,y0); % function call plot(t,y(...

27 days ago | 0

| accepted

Answered

for loops not working

The same goal can be achieved trivially using meshgrid() or ndgrid() without a loop: % Modes on a plate Lx=0.286; % length of...

for loops not working

The same goal can be achieved trivially using meshgrid() or ndgrid() without a loop: % Modes on a plate Lx=0.286; % length of...

27 days ago | 0

| accepted

Answered

How to extract column and row index and the corresponding value from a matrix?

m = [0 1 4 7 6 0]; [Rows,Columns] = ind2sub(size(m),(1:numel(m))'); Wanted = [Rows,Columns,m(:)]; Wa...

How to extract column and row index and the corresponding value from a matrix?

m = [0 1 4 7 6 0]; [Rows,Columns] = ind2sub(size(m),(1:numel(m))'); Wanted = [Rows,Columns,m(:)]; Wa...

27 days ago | 1