Error while processing model in Simulink
显示 更早的评论
Hi all! I am trying to read one line from txt file in Embedded MATLAB Function block and convert this line to float:
t_r=0;
r=nan;
t_r=fopen('<path>','r')
r=scanf(temp_roll, '%f')
fclose(t_r)
Everything is good, but sometimes it can be line with letters and MATLAB catch next error:
An error occurred while running the simulation and the simulation was terminated Caused by: Size mismatch for MATLAB expression 'fscanf'. Expected = 1x1 Actual = 0x0
I have tried to use try-catch exceptions, but it isn't possible to use it in EMF. How can I solve my problem? I want to just ignore cases when line contains letters.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Naming Conventions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!