2

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 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.