How do I save a structure?

조회 수: 4 (최근 30일)
Steven
Steven 2013년 4월 4일
students = struct('ID', 44, 'quiz', struct('One', 7, 'Two', 7.5, 'Three', 8))
students(2) = struct('ID', 33, 'quiz', struct('One', 5.5, 'Two', 6, 'Three', 6.5))
students(3) = struct('ID', 37, 'quiz', struct('One', 8, 'Two', 8, 'Three', 8))
students(4) = struct('ID', 24, 'quiz', struct('One', 6, 'Two', 7, 'Three', 8))
When I'm trying to save this so I can load it later in the program. How would I save it?
save(students.dat, '-struct', students)
Am I on the right track?

답변 (1개)

Walter Roberson
Walter Roberson 2013년 4월 4일
편집: Walter Roberson 2013년 4월 4일
save('students.mat', 'students');

카테고리

Help CenterFile Exchange에서 Adding custom doc에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by