concatenate matrices into one

Hello everyone! I have 180 matrices, 19*330, the are stored as mat files (B1C1,B1C2.....B1C15,B2C1,...,B2C15,...,B12C1,....,B12C15). I want to concatenate them into one matrix 180*19 by 330. does any one how can I do that?

댓글 수: 3

Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 19일
How your matrices are stored?
Sophi gra
Sophi gra 2016년 7월 19일
편집: Azzi Abdelmalek 2016년 7월 19일
they are in mat file! their names are
B1C1,B1C2.....B1C15,B2C1,...,B2C15,...,B12C1,....,B12C15
Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 19일
Please edit your question, don't let people guess what you are asking for!

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 19일
편집: Azzi Abdelmalek 2016년 7월 19일

0 개 추천

M=[]
for ii=1:15
for jj=1:12
name=sprintf('B%dC%d',ii,jj)
s=load(name)
n=fieldnames(s)
M=[M;s.n]
end
end

댓글 수: 8

Sophi gra
Sophi gra 2016년 7월 19일
the problem is I don't want to write down all matrices
Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 19일
Look at edited answer
Sophi gra
Sophi gra 2016년 7월 19일
isn't it possible to have one matrix 19*180 by 300?
Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 19일
편집: Azzi Abdelmalek 2016년 7월 19일
M=zeros(19,330,180);
k=00
for ii=1:15
for jj=1:12
k=k+1
name=sprintf('B%dC%d',ii,jj)
s=load(name)
n=fieldnames(s)
M(:,:,k)=s.n
end
end
Sophi gra
Sophi gra 2016년 7월 20일
thanks! but unfortunately I have got an error in reading the 'name'!
Azzi Abdelmalek
Azzi Abdelmalek 2016년 7월 20일
Maybe you need to specify the location of your files
Sophi gra
Sophi gra 2016년 7월 20일
the problem is there are a huge number of matrices! even if I write them in a loop it will not give me a matrix 180*19 by 330!
Sophi gra
Sophi gra 2016년 7월 20일
@aziz abdelmalek, thanks for taking your time! I will try that

이 질문은 마감되었습니다.

질문:

2016년 7월 19일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by