通过Matlab读取/加载不规则文件的一部分 [英] read/load parts of the irregular file by Matlab

查看:63
本文介绍了通过Matlab读取/加载不规则文件的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过matlab部分加载PTX文件(请参见以下示例)

I would like to partly load a PTX file by matlab (please see the following example)

我需要将前两行(2个数字)读写到2个变量中,例如a和b.并将第5行到末尾的数据读写到一个矩阵中

I need to read and write the first two row (2 numbers) into 2 variables say a and b. And read and write the data from 5th row to the end into a matrix

感谢您的帮助

114
221
1 0 0
1 0 0 0 
-5.566405 -7.161944 -1.144557 0.197208 24 29 35
-5.560656 -7.154540 -1.137673 0.222400 29 32 39
-5.559846 -7.153491 -1.131895 0.254002 37 40 49
-5.560894 -7.154833 -1.126452 0.305013 51 54 63
-5.560084 -7.153783 -1.120633 0.290013 72 76 88
-5.561128 -7.155119 -1.115189 0.243214 105 113 134
-5.563203 -7.157782 -1.109926 0.227604 130 143 177
-5.569191 -7.165479 -1.105504 0.201602 121 140 173
-7.833616 -10.078705 -1.546952 0.130007 94 112 134

推荐答案

查看 tdfread 函数,以便将数据导入Matlab.它应该类似于datafile = tdfread(filename, '\t').一旦有了,就索引到该函数返回的变量,如

Look at the tdfread function in order to get the data into Matlab. It should be something like datafile = tdfread(filename, '\t'). Once you have that, index into the variable returned from that function like

a = datafile(1, 1);
b = datafile(2, 1);
data = datafile(5:end, :);

这篇关于通过Matlab读取/加载不规则文件的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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