how to load a matrix into the workspace and save the value of a cell into a float variable

8 views (last 30 days)
Hi,
I have a matrix, called 1.mat, that I would like to load into the workspace and then save the cell (2,4) (line 2 and column 4) into the float variable var1. How can I do it? I thank you in advance,
Best regards,

Accepted Answer

DGM
DGM on 27 Mar 2021
A .mat file may contain multiple objects. Nobody can guess what's in your .mat file.
For the sake of demonstration, I'll assume your .mat file contains a hypothetical numeric array called 'myarray'.
load(1.mat);
var1=double(myarray(2,4));

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!