How do I do this? Pass a filename to a function?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
new user 00
am 1 Jul. 2018
Kommentiert: Image Analyst
am 2 Jul. 2018
I have created a function to browse a file in a gui. Now I have another function which does some calculations with the variables in the browsed file. So how do I load that file's contents in the new function?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 1 Jul. 2018
In your first function you pass the filename to the new function:
results = new_function(filename);
Then in new_function you read in the data and do something with it.
function results = new_function(filename)
data = importdata(filename); % of xlsread() or csvread() or readtable() or whatever...
% Now do something with data....
5 Kommentare
Image Analyst
am 2 Jul. 2018
Stuart has an excellent collection of them here:
two of which are the second and fourth links on Stephen's list.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Settings 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!