how to make a file .mat as a function input and load it inside the function
11 次查看(过去 30 天)
显示 更早的评论
Hey everyone
I am developping a function and i need a A.mat as an infile input of the function B , inside the function i hav to do file load , and to say that the function and the A.mat are in the same directory. so the alogorithme would be like thise
function B(filemat)
load filemat
thank you
0 个评论
采纳的回答
Walter Roberson
2019-7-21
编辑:Walter Roberson
2019-7-21
data = load(filemat);
Now the variables you need will each be fieldnames of the struct data
2 个评论
Walter Roberson
2019-7-21
You were using
load filemat
which is equivalent to
load('filemat')
which ignores the content of the variable named filemat and instead tries to load something literally named filemat.mat
My suggested code uses the content of the variable named filemat to see where it should load
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!