adding same variables to single .mat file
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I have 30 .mat files [data_1,data_2...data_30] containing same variable x with different values (row vectors) each of size x(1x3800000) stored in them.
I want to save them all in a single .mat file as a matrix y(30x3800000).
How can I do it? Please provide the syntax.
Thanks
댓글 수: 0
채택된 답변
Matt Kindig
2012년 3월 27일
y = NaN(30, 3800000); %pre-allocation
for k=1:30,
S = load( sprintf('data_%d.mat', k));
y(k,:) = S.x;
end
save 'y.mat' y
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!