load command in matlab loading blank file

后端 未结 1 1151
梦毁少年i
梦毁少年i 2021-01-21 22:55

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

positive    0x0    []

and am using

 load positive.t         


        
1条回答
  •  南方客
    南方客 (楼主)
    2021-01-21 23:47

    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.

    0 讨论(0)
提交回复
热议问题