Hello
I have many of array.
do you have any function for instead this CY.
CY = [cy(:,:,1) cy(:,:,2) cy(:,:,3) cy(:,:,4) cy(:,:,5) cy(:,:,6) cy(:,:,7) cy(:,:,8) cy(:,:,9) cy(:,:,10) cy(:,:,11) cy(:,:,12) cy(:,:,13) cy(:,:,14) cy(:,:,15) cy(:,:,16) cy(:,:,17) cy(:,:,18) cy(:,:,19) cy(:,:,20) cy(:,:,21) cy(:,:,22) cy(:,:,23) cy(:,:,24) cy(:,:,25) cy(:,:,26) cy(:,:,27) ... cy(:,:,3000];

 採用された回答

Hayden Raabe-Garmon
Hayden Raabe-Garmon 2022 年 7 月 18 日
編集済み: Hayden Raabe-Garmon 2022 年 7 月 18 日

0 投票

cy(:,:,1)=1
cy(:,:,2)=2
cy(:,:,3)=3
CY=squeeze(cy)'
CY =
1 2 3

3 件のコメント

Hayden Raabe-Garmon
Hayden Raabe-Garmon 2022 年 7 月 18 日
This would not be a Cell Array, this is a vector. A Cell/Cell Array is an entirely different class of variables
Mingde
Mingde 2022 年 7 月 18 日
Thank you
Mingde
Mingde 2022 年 7 月 18 日
Thank you. it is working.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2022 年 7 月 18 日

0 投票

Trust me, you don't want a cell array. I highly doubt it. It uses way more memory and is inefficient. You want code like @Hayden Raabe-Garmon gave you
CY=squeeze(cy)'
If you think you want a cell array, give justification (so I can talk you out of it).

3 件のコメント

Mingde
Mingde 2022 年 7 月 18 日
Thank you. it is working.
Mingde
Mingde 2022 年 7 月 19 日
編集済み: Mingde 2022 年 7 月 19 日
cy(:,:,1)=1
cy(:,:,2)=2
cy(:,:,3)=3
cy(:,:,4)=4
cy(:,:,5)=5
cy(:,:,6)=6
cy(:,:,7)=7
cy(:,:,8)=8
cy(:,:,9)=9
...
cy(:,:,100)=100
How Can I use loop for mean each 3 cell array?
For example
mean(A)
cy(:,:,1)=1
cy(:,:,2)=2
cy(:,:,3)=3
mean(B)
cy(:,:,4)=4
cy(:,:,5)=5
cy(:,:,6)=6
...
mean(Z)
cy(:,:,98)=98
cy(:,:,99)=99
cy(:,:,100)=100
Image Analyst
Image Analyst 2022 年 7 月 19 日
Again, we're not using cell arrays. And I don't know what range A, B, etc. cover. Do you just want the average of every group of 3 planes/slices? Like
A = cy(:, :, 1:3);
theMean = mean(A, 'all');

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

カテゴリ

ヘルプ センター および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by