Community Profile

photo

madhan ravi


3.307 total contributions since 2018

Communication through MATLAB is always better than arguing.

madhan ravi's Badges

  • Thankful Level 4
  • 12 Month Streak
  • Ace
  • Knowledgeable Level 4
  • Promoter
  • Commenter
  • Revival Level 3
  • Solver
  • First Answer

View details...

Contributions in
View by

Question


Is there a possibility to use varargin()?
Is there any other way to perform such operation? c = {rand,rand(4)}; z = @(...) mean(...); z(c{:}) The same can be achieved...

alrededor de 10 horas ago | 0 answers | 0

0

answers

Answered
Using ODE45 to solve two coupled second order ODEs
syms x1(t) x2(t) k1 k2 m Dx1 = diff(x1); D2x1 = diff(x1,2); Dx2 = diff(x2); D2x2 = diff(x2,2); Eq1 = D2x1 == (-(k1+k2)*x1+...

alrededor de 11 horas ago | 0

Answered
How to split cell array values into two text file?
v=dlmread('sample.txt') % your file name , use readmatrix() if you’re using 2019a or later dlmwrite('txt1.txt',v(:,1)) ...

alrededor de 13 horas ago | 0

| accepted

Answered
Could any body check my work? (Plot the function)
<https://in.mathworks.com/help/matlab/ref/linespec.html?s_tid=doc_ta#f26-701830> Your x and y doesn’t need square brackets. ...

1 día ago | 0

| accepted

Answered
How can i use a cell array in the symbolic variables?
Wanted = num2cell(symvar(B)) edit: After your comment. >> syms a b c d x y z >> A = [ a*(x^2) , b*(y^3) ; d*(x^2)*y , c ] ...

3 días ago | 1

Answered
How can we transpose a row vector into column vector in a cell
cellfun(@(x) x(:),A,'un',0)

3 días ago | 0

| accepted

Answered
location of logical matrix
Since you have a logical matrix it’simply: ix=all(matrix ,2); % logical indexing is efficient Wanted=find(ix)

3 días ago | 0

| accepted

Answered
how to use if in matlab for 2 matrix condition?
r=R2; r(abs(R1)<1)=R1

4 días ago | 0

Answered
surface Z contain more than one row or column
x1=0.0001:.001:.01; % you would have to decide the points yourself x2=0.003:0.001:0.08; [X,Y]=meshgrid(x1,x2); rho_ss=8000; ...

4 días ago | 1

Answered
fprintf in if statement
if x == 1 % where x is assumed as a scalar fprintf('hello') end help if doc if

4 días ago | 0

| accepted

Answered
how to add all 2d matrices in a 4D matrix???
sum(matrix,[4,3]) % 2018b >=

4 días ago | 1

Answered
Matrix dimensions must agree problem.
tx1.*tx2(:) % error is gone who knows if the logic is right. times(tx1,tx2(:)) % bsxfun(@times,tx1,tx2(:)) if 2016a <

6 días ago | 0

Answered
how to convert a 3*3 matrix into 1*9 using for loop
reshape(matrix,1,[]) % no loops needed , the beauty of MATLAB is the tasks are far simpler than most think.

7 días ago | 2

Answered
How does one accept an answer?
Only one answer can be accepted, as you have figured it out unaccepting and accepting the latter which you find useful for the n...

8 días ago | 1

| accepted

Answered
filling array with data
Abweichung=nan(size(Schlusskurs(:,1))); ii = T:-1:2; for k = 1:numel(ii) Abweichung(k) = log(Schlusskurs(ii(k)-1,1)/Schl...

8 días ago | 0

Answered
Find mean of rows containing decimal numbers in between integers in a column
Y = [1 0.098 0.00076 0.01 2 0.099 0.007 2 0.003 0.04 0.1 4]; Y=Y(:); ix=diff(find(~mod(Y,1)))-1; assert(nnz(~mod(Y,1))>2,'atl...

8 días ago | 1

| accepted

Answered
Searching matrix which contain specific value?
any(matrix(:)==value) % 1 means true ,false otherwise

8 días ago | 1

Answered
How to assign vectors to existing vector
newvector_2=vector_2; ix=nnz(~vector_2); v12=[vector_1,nonzeros(vector_2).']; u=unique(v12); d=setdiff(1:max(v12),v12); new...

9 días ago | 0

Answered
maximum value of matrix
[Val,ix]=max(A(:)); [r,~]=ind2sub(size(A),ix); A(r,:) %complete row where maximum exists

9 días ago | 1

| accepted

Answered
.mlx with MATLAB mobile
<https://in.mathworks.com/products/matlab-mobile.html> - see under *Limitations*

9 días ago | 0

Answered
Datetime shows month name and not number
Change *InputFormat* to *Format*.

9 días ago | 0

| accepted

Answered
how to create a vector with if-else statement
Bc(k) >= z(k)

9 días ago | 0

| accepted

Answered
Storing the inputs of a function on a structure (or cell or array)
d=struct('x',1,'y',2); [z,w] = tempFun(d) function [z,w] = tempFun(s) z = s.x+1; w = s.y+1; end

10 días ago | 0

| accepted

Answered
Split array based on given indices
C=A(B) D=setdiff(A,C)

10 días ago | 0

| accepted

Question


How to append a field to an existing structure in a mat file?
s.a = rand; s.b = rand(2); save('s.mat','s') load s s.c = 'yes' save('s.mat','s') % now the new field is added Is there a...

10 días ago | 1 answer | 0

1

answer

Question


Is there any other way to use coder for accumarray() ?
As stated in the documentation there are some limitations to some functions including accumarray(). Is there any other way to fe...

11 días ago | 1 answer | 0

1

answer

Question


Which way is better?
Note: This is not about preallocating variable in a loop. This is for general case. For instance: a(10,10) = 10; % the rest ar...

11 días ago | 1 answer | 1

1

answer

Answered
How to reshape every cell in a structure
arrayfun(@(x) reshape(b(x).a, 12, 4), 1:numel(b), 'UniformOutput', false)

11 días ago | 0

| accepted

Answered
how to add a new column to a table. The length of the column is longer and want to add from the first row till the last row of current table and neglect the rest of the column
Wanted = [T1,T2(1:size(T1,1),:)] %T1 table with 500 rows and the other with 1000 rows

11 días ago | 0

| accepted

Answered
how to sum elements of a cell array
sum(cat(3,V{:}),3)

11 días ago | 0

| accepted

Load more