从Matlab中的文件读取整数 [英] Reading integers from file in Matlab

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

问题描述

我有一个由一行分隔的数字的文件。我想扫描整个文件说input.txt,并将数字放入一个向量。



我有一个如何做的基本概念,但我不知道如何迭代,直到文件结束。

这个语言是Matlab。

预先感谢您的帮助!

解决方案尝试使用 textscan fscanf 函数。两者都可以一次读取整个矩阵。


I have a file with a numbers separated by line. I would like to scan an entire file say input.txt, and put the numbers into a vector.

I have a basic idea of how to do it but I do not know how to iterate until the end of the file.

The language is Matlab.

Thank you in advance!

解决方案

Try the textscan or fscanf functions. Both can read an entire matrix at one go.

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

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