How do I load two matrices from a single .mat file?

10 views (last 30 days)
Hi
I have a random file, let's call it rand.mat. This file has two matrices A and B (they're actually called A and B) and each one is 50x50. How do I load each of the two into two separate 50x50 matrices that I can later use in a formula to create a third 50x50 matrix?

Accepted Answer

Walter Roberson
Walter Roberson on 31 Oct 2019
file_struct = load('NameOfMat.mat', 'A', 'B');
A = file_struct.A;
B = file_struct.B;
  1 Comment
Mohamed Amine Mouajib
Mohamed Amine Mouajib on 31 Oct 2019
Thank you. You're a lifesaver, I went through 50 threads and still could not find a proper technique.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!