导入ASCII文件到Matlab [英] importing ASCII file to Matlab

查看:389
本文介绍了导入ASCII文件到Matlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将ASCII文件导入Matlab以便对其进行操作,我使用了: importdata(文件名)

I'm trying to import an ASCII file to Matlab in order to manipulate it,I used: importdata(filename)

但是要点是它没有将完整的文件加载到Matlab中,我的意思是,导入后我要使用一个结构,并且里面没有我的ASCII文件的所有数据.

but the point is it did not load the complete file in to Matlab,I mean after importing I'm taking a struct and inside that there is not all of my ASCII file's data.

在此方面,我将不胜感激.

I would really appreciate any help regarding that.

最佳,导航

推荐答案

除非您的数据是以某种特定方式组织的,否则您可能只想使用fread.在这里,您还可以指定要读取文件的多少字节或将其保留不变,它将完整读取文件.

Unless your data is organized in some specific manner you might just want to use fread. Here you can also specify how many bytes of the file you'd like to read or leave it as is and it will read the file in its entirety.

fid = fopen('myfile.txt','rt'); %//get the file handle and set it for reading
myData = fread(fid,inf) %//inf is not necessary, but that is how you would use the parameter, an integer is also a valid input

如果您的数据是定界的,请提供示例,以便任何人向您提供真正的洞察力,以了解可能出了什么问题.

If your data is delimited please provide an example in order for anyone to give you some real insight into what might be going wrong.

这篇关于导入ASCII文件到Matlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆