How to update certain cell values without using for loop

Hello,
Is there away to do these codes below without for loop to make it faster?
for x = 1:336
row{1,x}(p{1,x}(1:end)) = cellPix{1,x}(2:3:pMax(x)*3);
col{1,x}(p{1,x}(1:end)) = cellPix{1,x}(3:3:pMax(x)*3);
end
row,col,p, cellPix are cell arrays.
I appreciate for your help!

3 件のコメント

the cyclist
the cyclist 2023 年 4 月 5 日
Can you upload the data? You can use the paper clip icon in the INSERT section of the toolbar.
Walter Roberson
Walter Roberson 2023 年 4 月 5 日
Is there a particular reason you are indexing p{1,x}(1:end) insted of just using p{1,x} ?
DB
DB 2023 年 4 月 5 日
@the cyclist - I'm not sure I'm allowed to upload the data. Sorry.
@Walter Roberson - I tried using p{1,x} and it works the same. Thanks! Now, is there a way to eliminate the for loop?

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2023 年 4 月 5 日
編集済み: Matt J 2023 年 4 月 5 日

0 投票

There is no way to iterate over cell or struct arrays, other than with an M-Coded for-loop, or something equivalent. The way to iterate faster over your particular data would have to involve reorganizing it into matrix form, rather than cells.

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

リリース

R2023a

タグ

質問済み:

DB
2023 年 4 月 5 日

コメント済み:

DB
2023 年 4 月 5 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by