problem in cell matrix operations
显示 更早的评论
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 个评论
Adam Danz
2021-5-14
Please edit your question to format your code using the text/code toggle feature of the rich text editor.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!