Combining multiple columns into one matrix in Matalb

Click For Summary
SUMMARY

The discussion focuses on combining multiple columns into a single matrix in MATLAB, specifically merging 300 columns of dimensions 24x1 into a resultant matrix of dimensions 24x300. A user shared a code snippet using a for loop to achieve this, where each column of the new matrix is populated with the values from a smaller matrix. The suggested code is for i = 1:300; Big_Matrix(:,i) = small_matrix; end, with a note to adjust the indexing if necessary.

PREREQUISITES
  • Familiarity with MATLAB programming language
  • Understanding of matrix dimensions and indexing
  • Basic knowledge of for loops in programming
  • Experience with manipulating arrays in MATLAB
NEXT STEPS
  • Research MATLAB matrix manipulation techniques
  • Learn about MATLAB array indexing and dimensions
  • Explore MATLAB for loop structures and best practices
  • Investigate MATLAB functions for reshaping matrices
USEFUL FOR

Beginner MATLAB users, data analysts, and anyone looking to manipulate and combine matrices in MATLAB for data processing tasks.

bashar_aden
Messages
1
Reaction score
0
Hi

I am a beginner in using Matlab software. I want to combine 300 columns into one matrix. The dimension of each column is 24x1. Meaning, the resultant matrix should have a dimension of 24x300. Anybody can help me in this?

Any help is much appreciated!

Thanks
 
Physics news on Phys.org
try:

for i =1:300
Big_Matrix(:,i) = small_matrix;
end

if that isn't right, then replace (:,i) by (i,:), I always screw it up and have to redo it.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 10 ·
Replies
10
Views
5K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 3 ·
Replies
3
Views
4K