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

12 次查看(过去 30 天)
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,

采纳的回答

DGM
DGM 2021-3-27
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));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by