Perform action for Cell Array without using for loop
古いコメントを表示
I have a cell array of size (100,2000) and I want to take the last row of every cell and add it to a new cell array. I'm doing this to reduce the memory requirement of the cell array. Right now I am using a for loop to loop through the cells in the array, but this being matlab there probably is a better and faster way of doing this. Anyone have an idea how to perform this calculation without using a for loop?
The code below shows what I am talking about. r is 200, c is 2000 and the if statement checks if the cell is empty or not. If it is empty I don't want to do anything, if it contains data I want the last row of the cell to be saved to a new cell array.
Is there a faster way of doing this?
for ma = 1:r
for alti = 1:c
if isempty(itteration_record{ma,alti}) == 0
input_Config.itteration_record{ma,alti} = itteration_record{ma,alti}(end,:);
end
end
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!