声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1470|回复: 5

[编程技巧] 怎样用matlab编程统计txt文件中有多少个数

[复制链接]
发表于 2012-6-7 18:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
怎样用matlab编程统计txt文件中有多少个数
回复
分享到:

使用道具 举报

发表于 2012-6-8 01:21 | 显示全部楼层
help fscanf
help length

评分

1

查看全部评分

 楼主| 发表于 2012-6-10 20:10 | 显示全部楼层
回复 2 # ChaChing 的帖子

可以说下具体的程序语句吗
 楼主| 发表于 2012-6-10 20:11 | 显示全部楼层
回复 2 # ChaChing 的帖子

我是新手,毕业设计卡在这里了

点评

反对: 5.0
反对: 5
请善用编辑功能!  发表于 2012-6-10 22:30
发表于 2012-6-10 22:38 | 显示全部楼层
本帖最后由 ChaChing 于 2012-6-10 22:40 编辑

LZ有看了help!?
[A,count] = fscanf(fid, format, size) reads the amount of data specified by size, converts it according to the specified format string, and returns it along with a count of values successfully read. size is an argument that determines how much data is read. Valid options are

n          Read at most n numbers, characters, or strings.
inf        Read to the end of the file.
[m,n]   Read at most (m*n) numbers, characters, or strings. Fill a matrix of at most m rows in column order. n can be inf, but m cannot.
  1. fid=fopen('2.txt'); aa=fscanf(fid,'%g', [1 inf]); aa_size=length(aa)
复制代码

 楼主| 发表于 2012-6-11 15:15 | 显示全部楼层
回复 5 # ChaChing 的帖子

谢谢,解决了
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-17 01:14 , Processed in 0.057956 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表