load command in matlab loading blank file

牧云@^-^@ 提交于 2019-12-31 03:30:10

问题


I am loading a file in matlab, but it is being loaded as an empty variable.

positive    0x0    []

and am using

 load positive.txt

but the file is not empty. Is the something am wrong? P.S. I have loaded other files from the same folder successfully. Also I tried to rename it to positive.dat but that also didn't work. And it was an excel file that I saved as an text file.

and the first couple entries of the file, copied & pasted

04  10  19
04  10  36
04  10  28
04  16  16
04  14  01
04  20  21
04  20  06
04  20  28
04  13  14
04  13  17
04  13  02
04  01  16

回答1:


load command is only for MAT-files (file extension .mat) or ASCII files saved in MATLAB format, usually in MATLAB using save command. For all other file formats you should use some other command.

For text files you can use fopen, fscanf, fclose. For binary files you can use fopen, fread, fclose. fopen opens the file for reading and/or writing, fscanf or fread read data from file (fscanf reads text, fread binary data) and then fclose closes the file.

For Excel files you can use xlsread. xlsread does not need fopen or fclose.



来源:https://stackoverflow.com/questions/10337828/load-command-in-matlab-loading-blank-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!