loading .mat files in a simulink user defined function
이전 댓글 표시
Hello! I am working on some model validation and have built a 'Matlab function' block in Simulink. In the Matlab function I need to load some .mat files. The .mat files take and input value and return an output value that is used within the main Matlab function. The 'Matlab function' block is basically a copy of a .m file I have created and used before, (it works in matlab). Simulink has issues loading the .mat files however and I am not sure how to get around this problem. I assume this is because the .mat files are 'defined' in Matlab and not available to Simulink, though I am not sure why. Any ideas? Tips?
답변 (1개)
Azzi Abdelmalek
2014년 7월 23일
You didn't post how you are downloading your file, I guess you have used the command
load filename
If your mat file contains, for example three variables x,y and z, add this code
data=load('file')
x=data.x
y=data.y
z=data.z
댓글 수: 3
John
2014년 7월 24일
Azzi Abdelmalek
2014년 7월 24일
Please, shows us how you are trying to load your data, and why you can't use
filename='your_mat_file'
data=load(filename)
John
2014년 8월 22일
카테고리
도움말 센터 및 File Exchange에서 Modeling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!