フィルターのクリア

dividing a bigger array into sub-arrays and saving them as array-element

1 回表示 (過去 30 日間)
UET Hussain
UET Hussain 2018 年 7 月 4 日
コメント済み: UET Hussain 2018 年 7 月 5 日
Hi all, a small problem.
I have data, around 100,000x1 stored in an array. I want to split this bigger array into smaller arrays(not of same size). The number of sub-arrays is also not same (28, 30, 33 etc etc.). I will find different parameters from each sub-array and will save the results in excel file.
How can i save an array as element of array? I tried following code but it didn't worked.
cl1 = fdampl(1:1400);
cl2 = fdampl(2660:3720);
cl = zeros(30,1); %initialize the array
cl(1)= cl1;
cl(2)= cl2;
subplot (2,1,1);plot(cl(1))
subplot (2,1,2);plot(cl(2))
instead of "zeros" to initialize matrix, i also tried "cell" but it didn't worked either.
any help will be welcomed.
  2 件のコメント
Aarti Dwivedi
Aarti Dwivedi 2018 年 7 月 4 日
Are the number of parameters calculated for each sub-array the same?
UET Hussain
UET Hussain 2018 年 7 月 5 日
yups.... same operations will be performed on each array

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

採用された回答

Stephen23
Stephen23 2018 年 7 月 4 日
編集済み: Stephen23 2018 年 7 月 4 日
You could use a cell array:
cl = cell(30,1); %initialize the array
cl{1} = cl1;
cl{2} = cl2;
etc.
Note that cell arrays use two different kinds of indexing, you need to know the difference:
  1 件のコメント
UET Hussain
UET Hussain 2018 年 7 月 5 日
That's cool. After I will get the array of arrays, i will apply 4 different fornmuale on each sub-array and then save the output. inside loop, i have to use
for i=1:3
a = cl{i}
plot(a);
etc. etc.
end
here i need to put {} curly brackets instead of ().
Thanks Stephen, really appreciated.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by