MATLAB Answers

0

How do I assign part of a matrix to be a variable

Asked by Emilee Burris on 25 Mar 2019
Latest activity Answered by Torsten
on 25 Mar 2019
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?

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by Rik
on 25 Mar 2019
 Accepted Answer

data=rand(9,10);%generate some random data
a=data(1:3,:);
b=data(4:6,:);
c=data(7:9,:);

  0 Comments

Sign in to comment.


Answer by Torsten
on 25 Mar 2019

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

  0 Comments

Sign in to comment.