How Can I Manipulate Multiple Matrices at Once

I'm dealing with large number of matrices and I have to reshape them first and add all of them in a single matrix. To be clear: In my workspace there are 31X31 sized 50 matrices and named in an order " catal01, catal02, catal03...,catal50". Firstly I want to reshape all these matrices to 961X1 sized matrices. Any A matrix;
A=catal01(:)
After completing making a single column process to all catalxx matrices I want to create a single matrix with these 50 columns. So ı will have 961X50 sized single matrix. I thought using for loop but cant succeed. How can I solve this problem?

3 Comments

i just started using MATLAB for couple of weeks ago. i will consider your comments. thanks.
They are not just my comments, but they are the combined comments of many code experts much better than you or I. You should consider them.

Sign in to comment.

Answers (2)

catal01=rand(10,1)
catal02=rand(10,1)
catal03=rand(10,1)
v=[]
for k=1:3
a=evalin('base',sprintf('catal%0.2d',k))
v=[v a]
end

3 Comments

it creates 31X1560 sized matrix, probably not as i wanted
Just adapt the code to your problem
v=[]
for k=1:3
a=evalin('base',sprintf('catal%0.2d',k))
v=[v a(:)]
end

Sign in to comment.

Categories

Asked:

on 28 Mar 2016

Edited:

on 19 Jun 2019

Community Treasure Hunt

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

Start Hunting!