The error using "load" and "fgets" codes in MATLAB 2013a?
1 次查看(过去 30 天)
显示 更早的评论
I just want to use "load" command and "fgets" command in same time.
fid is a txt file which contains the directories of 40 seperate file.
fid=
materialproperties/uniaxialelement1.txt
materialproperties/uniaxialelement2.txt
materialproperties/uniaxialelement3.txt
....
....
....
So i use fgets(fid) to get the directory of any file as
fgets(fid)= materialproperties/uniaxialelement2.txt
then I need the data of this file so i use" load" command
Read_Pr=load(fgets(fid))
this code work efficently in MATLAB 2014a but i have to run the code in MATLAB 2013a but i get an error.
So what can i do for running this code without any errors in MATLAB2013a?
Whats is difference in using "load" code?
4 个评论
Stephen23
2018-12-29
编辑:Stephen23
2018-12-29
@ugur ugur: the error message gives the filename that you are trying to use, and you can clearly see that it includes a newline at the end:
... 'materialproperties/uniaxialelement2.txt
'
This is exacty as I already described in my answer, together with the solution. If you used my answer then there would be no newline character at the end.
PS: I doubt that the error message actually says "Enable to read file".
PPS: remember to accept my answer (it answers your question) and also answers to your other questions:
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!