Community Profile

photo

madhan ravi


3,295 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
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]; Y=Y(:); ix=diff(find(~mod(Y,1)))-1; assert(nnz(~mod(Y,1))>2,'atlea...

12 minutes ago | 1

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

40 minutes ago | 0

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

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

1 day ago | 0

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

1 day ago | 1

| accepted

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

1 day ago | 0

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

1 day ago | 0

| accepted

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

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

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

2 days ago | 0

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

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

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

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

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

3 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

3 days ago | 0

| accepted

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

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

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

3 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

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

3 days ago | 0

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

3 days ago | 0

| accepted

Answered
Double = in one line of code
doc deal

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

4 days ago | 1 answer | 0

1

answer

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

4 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{:})

5 days ago | 0

| accepted

Answered
Calculate statistical parameters from certain rows of a matrix
Wanted=splitapply(@mean,x(:,2),findgroups(x(:,1))) % x(:,1) is Day and x(:,2) is Temperature % or if you're using version prior...

5 days ago | 0

| accepted

Answered
breaking a large table into smaller one
ix = diff([0,X,size(x,1)]); % x your table Wanted = mat2cell(x,ix)

5 days ago | 0

| accepted

Answered
Need to Split a column of type 'string' in a Table in to group of 4 characters giving new names to the result.
v=regexp(strrep(T.Data,' ',''),'\w{4}','match');% naming a table with a variable name table is a terrible idea (will hinder the ...

6 days ago | 1

Load more