Filter löschen
Filter löschen

how to load .mat file into a function

48 Ansichten (letzte 30 Tage)
Vittoria D'Avino
Vittoria D'Avino am 13 Mär. 2014
Kommentiert: SRI am 14 Mär. 2014
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 Kommentare
SRI
SRI am 14 Mär. 2014
Bearbeitet: SRI am 14 Mär. 2014
function Exchange = Input(A)
A = magic(8);
save mydata.mat A
load mydata.mat
disp(A)
SRI
SRI am 14 Mär. 2014
just try this out in two script one as function file next as main file

Melden Sie sich an, um zu kommentieren.

Antworten (2)

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

Suneesh
Suneesh am 13 Mär. 2014

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by