Using or Creating block matrices in Matlab

  • Context: MATLAB 
  • Thread starter Thread starter heisenberg90
  • Start date Start date
  • Tags Tags
    Block Matlab Matrices
Click For Summary
SUMMARY

The discussion focuses on creating and manipulating block matrices in MATLAB, specifically how to extract a 4x3 portion from a larger 12x3 matrix. The user demonstrates the process by defining a matrix of ones and utilizing the command matrix(1:4,1:3) to achieve the desired submatrix. This method effectively allows for targeted data extraction for plotting purposes. The solution highlights the simplicity of matrix indexing in MATLAB.

PREREQUISITES
  • Basic understanding of MATLAB syntax and commands
  • Familiarity with matrix indexing in MATLAB
  • Knowledge of data visualization techniques in MATLAB
  • Experience with matrix creation and manipulation in MATLAB
NEXT STEPS
  • Explore advanced MATLAB matrix operations and functions
  • Learn about MATLAB plotting functions for visualizing matrix data
  • Investigate MATLAB's data types and structures for efficient data handling
  • Study MATLAB's indexing techniques for multidimensional arrays
USEFUL FOR

MATLAB users, data analysts, and engineers who need to manipulate and visualize matrix data efficiently.

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);
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 5 ·
Replies
5
Views
3K