How to select 10% of a matrix with an increment of 10% until 80%

1 回表示 (過去 30 日間)
Joana
Joana 2021 年 2 月 23 日
編集済み: KALYAN ACHARJYA 2021 年 2 月 23 日
Hi
I have a matrix x with size 200x353. I need to sleect 10% of the matrix with an incerement of 10% until 80%, so something like 10:10:80. And the run some analysis on the selected data.
ANy help on how to do that.?
Thanks

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 23 日
編集済み: KALYAN ACHARJYA 2021 年 2 月 23 日
Note that the data are overlaping in each segment as per the requirements
1st cell 1% of data
2nd Cell 10% of data
3rd Cell 20% of data
.....
If data are non overlaping case,it can be easiliy achieved using mat2cell.
One Attempt: Do modify accordingly
data=randi(100,[200,353]);
[r,c]=size(data);
r=1:round(r/10):r;
c=1:round(c/10):c;
data_seg=cells(1,8);%80 for 8
for i=1:length(1:8)
data_seg{i}=data(1:r(i),1:c(i));
end
data_seg
  2 件のコメント
Joana
Joana 2021 年 2 月 23 日
That works very well for me Sir, Thanks a lot.
Although i have one more point. How can i save the rest of 99 90 80 70...20% of the total data.?
like if i save the first cell of 10% of the data then i need the rest of 90% of the data stored to process.
Thanks
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 2 月 23 日
編集済み: KALYAN ACHARJYA 2021 年 2 月 23 日
how can i save the rest of 99 90 80 70...20% of the total data.?
reverse the same, start from last
end:decrement:1
2md: please ensure that arary size must be rantangular shape (It can't be arbitary shape)

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

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by