How can I split a matrix into 4 regions?
1 回表示 (過去 30 日間)
古いコメントを表示
data = [0, 5:120; [(10:200)', zeros(191, 116)]]
![Capture.PNG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/268145/Capture.png)
1 件のコメント
Sindar
2020 年 1 月 29 日
What do you mean by "split"? Do you want new variables? Do you want an equally-sized matrix that tells you which region each element is in? Is there logic to the split?
回答 (1 件)
Anmol Dhiman
2020 年 1 月 31 日
Hi Mariana,
You have not mentioned about the criteria of splitting. So, I am assuming that is based on the values of the elements. I am also assuming that you want to store the values of one region together. Hence, you can use an array to store them.
There is no direct approach for splitting the matrix randomly. You can see the below link to extract elements from matrix based on condition and use this. Apply four times( as there are four regions) based on each condition.
Hope it helps
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!