问题
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