how to load .mat file into a function

47 次查看(过去 30 天)
Hi,
I need your help if possible. I've recently started to learn matlab! I need to load a .mat file (a matrix of 57x9) as input of my function. Can you say me how to write this in the code of the function?
thanks for your time
Vittoria
  2 个评论
SRI
SRI 2014-3-14
编辑:SRI 2014-3-14
function Exchange = Input(A)
A = magic(8);
save mydata.mat A
load mydata.mat
disp(A)
SRI
SRI 2014-3-14
just try this out in two script one as function file next as main file

请先登录,再进行评论。

回答(2 个)

Marta Salas
Marta Salas 2014-3-13
function myfunction(myMat)
load(myMat);
%your code
you call your function as: myfunction('path/MyMat.mat')

Suneesh
Suneesh 2014-3-13

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by