在matlab中加载命令加载空白文件 [英] load command in matlab loading blank file
问题描述
我正在matlab中加载一个文件,但它是作为一个空变量被加载的。
正值0x0 []
正在使用
load positive.txt
但文件不是空的。是错的吗?
P.S.我已成功从同一文件夹加载其他文件。此外,我试图重新命名为positive.dat,但也没有工作。这是一个excel文件,我保存为一个文本文件。
和文件的第一对夫妇条目,复制&
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
load
命令仅适用于MAT文件(文件扩展名 .mat
)或以MATLAB格式保存的ASCII文件,通常在MATLAB中使用保存
命令。对于所有其他文件格式,您应该使用其他命令。
对于文本文件,您可以使用 fopen
, fscanf
, fclose
。对于二进制文件,您可以使用 fopen
, fread
, fclose
。 打开或< $ c>从文件读取数据(
fscanf
读取文本, fread
二进制数据),然后读取 fclose
关闭文件。
对于Excel文件,您可以使用 xlsread
。 xlsread
不需要 fopen
或 fclose
。
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
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
.
这篇关于在matlab中加载命令加载空白文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!