필터 지우기
필터 지우기

How to read and save different variables in a matfile to another mat file

조회 수: 2 (최근 30일)
How to read two specific variables from a .mat file having different variables and save it to another .mat file without changing the variable name.

채택된 답변

Stephen23
Stephen23 2018년 9월 21일
편집: Stephen23 2018년 9월 21일
S = load('file1.mat','var1','var2');
save('file2.mat','-struct','S')
OR
S = load('file1.mat');
save('file2.mat','-struct','S','var1','var2')
  댓글 수: 5
Stephen23
Stephen23 2018년 9월 24일
@sachin k p: if the names are different then you could try the '-append' option, like this:
S = load('file1.mat','var1','var2');
save('file2.mat','-struct','S','-append')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile 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!

Translated by