使用Matlab将矩阵保存到csv和txt文件
作者:Huichin 时间:2022-11-25 16:08:35
Matlab将矩阵保存到csv和txt文件
语法:
csvwrite(filename,M)
csvwrite(filename,M,row,col)
写入txt用dlmwrite(filename,M)//M为矩阵
示例:
csvwrite('D:\桌面文件\20210330力实验\力数据\10-16.csv',c) %c为矩阵
Matlab矩阵数据生成.csv表格
参加kaggle比赛要上传csv格式的文件,于是有了下面的代码
%图片名称
name=file_name;
%转置
m1=m';
%表头
various={'img','c0','c1','c2','c3','c4','c5','c6','c7','c8','c9'};
%表的内容
result_table=table(name,m1(:,1),m1(:,2),m1(:,3),m1(:,4),m1(:,5),m1(:,6),m1(:,7),m1(:,8),m1(:,9),m1(:,10),'VariableNames',various);
%创建csv表格
writetable(result_table, 'teat_result3.csv')
效果图:
来源:https://blog.csdn.net/Huichin_Min/article/details/115358892
标签:Matlab,矩阵,csv,txt文件
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
JavaScript中自带的 reduce()方法使用示例详解
2024-02-24 09:37:11
数据库复制性能测试 推送模式性能测试
2012-07-11 16:13:52
PHP实现逐行删除文件右侧空格的方法 <font color=red>原创</font>
2023-11-22 05:11:25
python使用ctypes调用扩展模块的实例方法
2021-11-01 22:22:58
![](https://img.aspxhome.com/file/2023/2/82542_0s.png)
浅析mysql.data.dll驱动各版本介绍
2024-01-24 04:26:30
![](https://img.aspxhome.com/file/2023/9/69169_0s.png)
python 实现UTC时间加减的方法
2023-08-06 15:35:42
JavaScript实现五子棋游戏的方法详解
2024-04-30 10:11:54
![](https://img.aspxhome.com/file/2023/3/130493_0s.gif)
图片自适应宽度新解决方法
2009-09-22 14:55:00
解决jupyter 在浏览器中 代码不执行的问题
2023-05-08 01:21:35
![](https://img.aspxhome.com/file/2023/9/85059_0s.jpg)
Python动刷新抢12306火车票的代码(附源码)
2021-04-27 08:13:24
![](https://img.aspxhome.com/file/2023/2/105272_0s.jpg)
Go中的应用配置管理详解
2023-06-21 00:40:55
浅谈Python xlwings 读取Excel文件的正确姿势
2021-10-15 23:33:36
![](https://img.aspxhome.com/file/2023/3/112553_0s.png)
Python练习-购物单
2023-01-21 16:27:33
Mysql 数据库双机热备的配置方法
2010-06-09 19:13:00
node.js微信公众平台开发教程
2024-05-03 15:56:19
![](https://img.aspxhome.com/file/2023/3/129353_0s.png)
python标准库sys和OS的函数使用方法与实例详解
2022-06-24 20:22:42
Python时间模块datetime、time、calendar的使用方法
2023-04-02 06:44:16
浅谈Transact-SQL
2024-01-23 20:13:22
Python遍历numpy数组的实例
2021-08-30 08:49:37
使用BootStrap实现用户登录界面UI
2023-07-02 05:19:51
![](https://img.aspxhome.com/file/2023/6/137006_0s.png)