Iterate between fixed numbers in an array and store into a matrix.
1 回表示 (過去 30 日間)
古いコメントを表示
I'm trying to iterate an array for the first 250 element and store certain values like the max, min, mean and peak2peak in a array. I first want to iterate the 250 elements out of an array of 98000 and store these values in a different array and then continue from 251st element until it reaches 98000.
0 件のコメント
回答 (1 件)
Stephan
2019 年 10 月 28 日
編集済み: Stephan
2019 年 10 月 28 日
I suggest to reshape the array to have 250 rows. The most Matlab functions like mean, max, min, sum... work on the columns of an array by default, so this is easy to write. For example:
A = randi(100,10,5)
A_mean = mean(A)
A_max = max(A)
A_min = min(A)
A =
37 51 88 23 44
63 52 56 18 12
79 82 63 23 26
9 80 59 44 41
93 65 21 32 60
78 38 31 93 27
49 82 48 44 61
44 54 24 19 72
45 36 85 91 23
31 94 20 98 12
A_mean =
52.8000 63.4000 49.5000 48.5000 37.8000
A_max =
93 94 88 98 72
A_min =
9 36 20 18 12
To reshape use:
A = reshape(YourArrayName,250,[]);
Writing them all in one array would work this way:
A_properties(1,:) = mean(A);
A_properties(2,:) = max(A);
A_properties(3,:) = min(A);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calendar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!