フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Extracting 1 cell from a multiple matricies

1 回表示 (過去 30 日間)
Robert
Robert 2014 年 11 月 11 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have 40 matricies, each 35x43. I want to make a series of columns each 8x5 where each value is the first cell from each of my 40 matrices (8 years of data 5 different types of data).
How can I do this? I'm pretty new to matlab so detail would be appreciated :)

回答 (1 件)

Image Analyst
Image Analyst 2014 年 11 月 11 日
Assuming when you say "cell" you really mean "element" of a regular 2D matrix and not a cell of a cell array, then you can use linear indexing to get the first (upper left) element of each of your 40 matrices:
Output(1,1) = matrix1(1)
Output(2,1) = matrix2(1)
Output(3,1) = matrix3(1)
Output(4,1) = matrix4(1)
Output(5,1) = matrix5(1)
Output(6,1) = matrix6(1)
Output(7,1) = matrix7(1)
Output(8,1) = matrix8(1)
Output(1,2) = matrix9(1)
Output(2,2) = matrix10(1)
Output(3,2) = matrix11(1)
Output(4,2) = matrix12(1)
Output(5,2) = matrix13(1)
Output(6,2) = matrix14(1)
Output(7,2) = matrix15(1)
etc.
You could also use (1,1) instead of (1) if that's what you prefer - they're equivalent.
If that's not what you meant, then please read the FAQ to get your terminology accurate: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by