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
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
Rik 2019-3-25
data=rand(9,10);%generate some random data
a=data(1:3,:);
b=data(4:6,:);
c=data(7:9,:);

更多回答(1 个)

Torsten
Torsten 2019-3-25
A1 = A(1:3,:);
A2 = A(4:6,:);
A3 = A(7:9,:);

类别

Help CenterFile Exchange 中查找有关 Visual Exploration 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by