problem in cell matrix operations
Mostrar comentarios más antiguos
Hello
I have code like this which gives out a 5*1 cell matrix:
row = [0; 1; 2; 3; 4] ;
Coh = [15;16 ;17; 18; 20;19;7;8;22;25] ;
N = length(A) ;
Csurf = cell(N,1) ;
for i = 1:N
if row(i) == 0
Csurf{i} = 0 ;
else
Csurf{i} = Coh(1:row(i)) ;
Coh(1:row(i)) = [] ;
end
end
end
----------------------------------------------------
Now imagine that both row and Coh become cell matrices by the below repmat command,
Nmc=2
BB = repmat({row},Nmc,1);
CV=repmat({Coh},Nmc,1);
I have to write a code which considers the first cell of both BB and CV together and do the calculations as in the first code and then consider the second cell of BB and CV together and do the same calculations. The result would be a 5*2 cell matrix as Nmc=2. How should i formulate this?should i define a for loop? i am not good at cell indexing!
Any help is highly appreciated.
1 comentario
Adam Danz
el 14 de Mayo de 2021
Please edit your question to format your code using the text/code toggle feature of the rich text editor.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!