How do I assign part of a matrix to be a variable
210 次查看(过去 30 天)
显示 更早的评论
I have a 9x10 matrix of data and I want to assign the first 3 rows to one variable then 4 through 6 rows to the second variable and then 7 through 9 to the last variable.
How do I do this while making sure I get all 10 columns in each row along with the rows?
2 个评论
Walter Roberson
2020-1-16
data=rand(9,10);%generate some random data
a=data(:,1:3);
b=data(:,4:6);
c=data(:,7:9);
d=data(:,10);
采纳的回答
Rik
2019-3-25
data=rand(9,10);%generate some random data
a=data(1:3,:);
b=data(4:6,:);
c=data(7:9,:);
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Visual Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!