Community Profile

photo

madhan ravi


3,298 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

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 <

1 day 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.

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

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

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

3 days ago | 1

| accepted

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

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

4 days ago | 0

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

4 days ago | 1

| accepted

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

4 days ago | 0

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

4 days ago | 0

| accepted

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

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

5 days ago | 0

| accepted

Answered
how to construct a cell array from another cell array
V1={[1 2 3 4],[3 4 1 0],[3 5 -1 -9]}; V2={[-1 -2 9],[0 9 6]}; [m,n]=deal(numel(V1),numel(V2)); A =cell(m,n); for k = 1:m ...

5 days ago | 0

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

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

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

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

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

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

6 days ago | 0

| accepted

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

6 days ago | 0

| accepted

Answered
How to extract data to a matrix from cell arrays with varying cell lengths?
xy = cat(1,cell_array{:}); x = xy(:,1) y = xy(:,2)

6 days ago | 0

Answered
How to reshape nested cell arrays in a table
t(:,2:4)=varfun(@(x) {reshape(x{:},4,12)},t(:,2:4))

6 days ago | 0

| accepted

Answered
Replace rows in one array with values from another column
v1(v1==5)=v2 % where v1 is array with 5s

6 days ago | 0

| accepted

Answered
pick up elements from a cell array and the result must be a cell array
cellfun(@(x) reshape(x(1:end-1),[],1), V,'un',0)

6 days ago | 0

Answered
Call pts with z value within a range
z = A(:,3); result_B = A((z>1)&(z<9),:)

6 days ago | 0

| accepted

Answered
Double = in one line of code
doc deal

7 days ago | 2

Question


Why does gpuArray() error out?
What does the error mean? >> A = gpuArray( rand(1024) ); There is a problem with the graphics driver or with this GPU device...

7 days ago | 1 answer | 0

1

answer

Answered
selecting specific layers in the 3rd dimension of a matric
squeeze(mean(A(:,:,43:53)))

7 days ago | 0

| accepted

Answered
Transferring cell array elements into a matrix
test_ca = {[1 2 3],[4 5 6];[7 8 9],[10 11 12]} .'; new_mat = cat(1,test_ca{:})

7 days ago | 0

| accepted

Load more