How to show mat file to struct ?

31 views (last 30 days)
Hello, I wish to know how to show data in .mat file in the form struct and save it back to mat file format?

Accepted Answer

Star Strider
Star Strider on 26 Apr 2019
If you load the .mat file to a variable, it will automatically be a structure:
Data = load('yourMatFile.mat');
You can then access the variables in the file as:
x = Data.Variable1;
y = Data.Variable2;
and so forth, depending on the variable names in the .mat file.
See the documentation section on: Load List of Variables Into Structure Array (link) for an extended discussion.
  4 Comments
Chidiebere Ike
Chidiebere Ike on 27 Apr 2019
Thanks, I appreciate
Star Strider
Star Strider on 27 Apr 2019
As always, my pleasure.

Sign in to comment.

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!