Using or Creating block matrices in Matlab

  • Context: MATLAB 
  • Thread starter Thread starter heisenberg90
  • Start date Start date
  • Tags Tags
    Block Matlab Matrices
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 4K views
heisenberg90
Messages
1
Reaction score
0
I am trying to put a lot of data into a matrix to call upon later in plotting. From a masterfile, I need to call on the (:,1) values on x and y, and the (:,2) values in x and y. It is easy to construct a 12x3 matrix to contain all of this information, however when I am plotting I want to call only a 4x3 portion of this 12x3 matrix. Which command could I use to limit this call to just that portion of my larger matrix? Thank you in advance!
 
Physics news on Phys.org
You can use a code like this, I will define a matrix of ones for clarity.

Code:
%create matrix
matrix = ones(12,3);

%define 4x3 portion
four_by_three = matrix(1:4,1:3); [I]%note matrix(1:4,:) also works here[/I]
display(four_by_three);