read from and write to file
使用两种方法读数据
clc;clearvars;
fid=fopen('data.txt');
tline=fgetl(fid);
nline=1;%表示行数
while ischar(tline)%do some work%first method:use strfind(tline,' ');'seperator'%data type:12 30 8 23 9 40% 30 12 11 3 6 7%%-------------------------------
% index=strfind(tline,' ');
% newindex=[0 index length(tline)+1];%在前面和后面多增加一个seperator
% for i=1:length(newindex)-1
% str=tline(newindex(i)+1:newindex(i+1)-1);
% data{nline,i}=str;
% end
% nline=nline+1;
% tline=fgetl(fid);%获取下一行%%---------------------------------%second method:use textscan(tline,'%s'),以cell的形式扫入到字符串 str_c=textscan(tline,'%s');data{nline}=str_c;nline=nline+1;tline=fgetl(fid);
end
转载于:https://www.cnblogs.com/raby/p/5886686.html
read from and write to file相关推荐
- Access to XMLHttpRequest at file from origin ‘null‘ has been blocked by CORS policy谷歌浏览器本地打开项目js文件报错
Access to XMLHttpRequest at 'file:///xxxxx/PQ.BaseInfo.proto' from origin 'null' has been blocked by ...
- deepin初试与file browser使用小结
①c盘也可以弄压缩盘安装deepin啊 ②deepin硬盘格式Windows看不见,而在deepin中Windows硬盘可以看见 ③安装完deepin如果直接进入了win10,其实不用费这么大劲搞来搞 ...
- libgstreamer-1.0.so.0: cannot open shared object file: No such file or directory
1. 问题现象 error while loading shared libraries: libgstreamer-1.0.so.0: cannot open shared object file: ...
- pip 升级之后提示 bash: /usr/bin/pip3: No such file or directory
1. 问题现象 pip 升级之后使用时报错: $ pip3 -V bash: /usr/bin/pip3: No such file or directory 通过命令查找 pip 位置 $ whic ...
- pip install faiss-gpu失败unable to execute ‘swig‘: No such file or directory
1. 安装报错 unable to execute 'swig': No such file or directory error: command 'swig' failed with exit s ...
- GCC 链接 xxx:No such file or directory 及运行可执行文件 error while loading shared libraries: xxx.so 解决方案
关于 GCC 提示找不到指定库文件的这个问题,通常出现在以下 2 个场景中: 利用静态库或者动态库文件实现链接操作(生成可执行文件)时,·GCC 可能会提示 xxx:No such file or d ...
- Ubuntu20.04安装zabbix以及Cannot create the configuration file解决
添加zabbix的扩展源 echo 'deb http://mirrors.aliyun.com/zabbix/zabbix/5.0/ubuntu/dists/ focal main' >> ...
- npm install遇到ENOENT: no such file or directory, rename错误
问题描述 npm 安装模块时遇到ENOENT: no such file or directory, rename错误 解决办法 1.删除根目录下package-lock.json文件 2.删除根目录 ...
- Java的File类
File类的理解 常用构造器 常用方法 代码示例 练习 File类的理解 1.File类的一个对象,代表一个文件或一个文件目录(俗称:文件夹) 2.File类声明在java.io中 3.File类中涉 ...
- 2021年大数据Flink(四十八):扩展阅读 Streaming File Sink
目录 扩展阅读 Streaming File Sink 介绍 场景描述 Bucket和SubTask.PartFile 案例演示 扩展阅读 配置详解 PartFile PartFile序列化编码 ...
最新文章
- 模块架构不是软件成功的“决定因素”
- java开发中的Mutex vs Semaphore
- PyTorch 深度学习: 60 分钟极速入门
- 给刚入职开发人员的几句心里话
- 手把手详解堆排序,堆就这么难懂?没有人看一遍学不会的,如果学不会,那就两遍吧
- Webpack进阶(二)代码分割 Code Splitting
- 前端 JS/TS 调用 ASP.NET Core gRPC-Web
- react.lazy 路由懒加载_React lazy/Suspense使用及源码解析
- 消息中间件 --- Kafka快速入门
- 用java编写保留两位小数_Java保留两位小数的几种写法总结
- 14 MM配置-BP业务伙伴-定义供应商科目组和字段选择
- 编程之美2014 资格赛题目3 : 格格取数
- shell打印正三角形
- Premiere视频导出格式
- 硬盘显示无法访问由于IO设备错误的文件找到办法
- Sentinel简单使用
- Snapchat面试题:移除K位
- Nginx无证书反向代理
- IT运维管理之数据维护技术方案
- android英文参考文献,英文参考文献
热门文章
- 录屏软件电脑_电脑录屏用什么软件?电脑录屏软件集锦
- 【2019牛客多校第七场:H】Pair(数位dp)
- 【洛谷P1774】最接近神的人_NOI导刊2010提高(02)(模版题---求逆序对数目+离散化---树状数组/权值线段树)
- 【LA3942】Remember the World(初识前缀树Trie----模版题 + dp)
- 关于git clone http://xxxxxxxxxxx报错的问题
- java高级工程师 考试_JAVA高级工程师笔试题及答案
- 8g内存一般占用多少_手机6G和8G运存有什么不同,8G运存真比6G流畅?这也要考虑处理器...
- 算法:258. Add Digits 各位相加
- JSON Web Token从入门到精通
- 【易实战】Spring Cloud Greenwich Hystrix:服务容错保护