matlab如何读取含有文本的TXT数据文件并存入多个数组?最好每一列数字存到一个一维数组中 50
假设数据为这样格式的:data.txt$GPGGA,035934.50,3906.1448,N,11709.5060,E,1,09,0.9,30.08,M,-8.80,M...
假设数据为这样格式的:data.txt
$GPGGA,035934.50,3906.1448,N,11709.5060,E,1,09,0.9,30.08,M,-8.80,M,,*4F
$GPGGA,035935.00,3906.1448,N,11709.5060,E,1,09,0.9,30.06,M,-8.80,M,,*45
$GPGGA,035935.50,3906.1448,N,11709.5060,E,1,09,0.9,30.07,M,-8.80,M,,*41
$GPGGA,035936.00,3906.1448,N,11709.5060,E,1,09,0.9,30.08,M,-8.80,M,,*48
$GPGGA,035936.50,3906.1448,N,11709.5060,E,1,09,0.9,30.11,M,-8.80,M,,*45
$GPGGA,035937.00,3906.1448,N,11709.5060,E,1,09,0.9,30.13,M,-8.80,M,,*43
$GPGGA,035937.50,3906.1448,N,11709.5060,E,1,09,0.9,30.15,M,-8.80,M,,*40
$GPGGA,035938.00,3906.1448,N,11709.5060,E,1,09,0.9,30.14,M,-8.80,M,,*4B
$GPGGA,035938.50,3906.1448,N,11709.5060,E,1,09,0.9,30.16,M,-8.80,M,,*4C
$GPGGA,035939.00,3906.1448,N,11709.5060,E,1,09,0.9,30.15,M,-8.80,M,,*4B
$GPGGA,035939.50,3906.1447,N,11709.5060,E,1,09,0.9,30.20,M,-8.80,M,,*47 展开
$GPGGA,035934.50,3906.1448,N,11709.5060,E,1,09,0.9,30.08,M,-8.80,M,,*4F
$GPGGA,035935.00,3906.1448,N,11709.5060,E,1,09,0.9,30.06,M,-8.80,M,,*45
$GPGGA,035935.50,3906.1448,N,11709.5060,E,1,09,0.9,30.07,M,-8.80,M,,*41
$GPGGA,035936.00,3906.1448,N,11709.5060,E,1,09,0.9,30.08,M,-8.80,M,,*48
$GPGGA,035936.50,3906.1448,N,11709.5060,E,1,09,0.9,30.11,M,-8.80,M,,*45
$GPGGA,035937.00,3906.1448,N,11709.5060,E,1,09,0.9,30.13,M,-8.80,M,,*43
$GPGGA,035937.50,3906.1448,N,11709.5060,E,1,09,0.9,30.15,M,-8.80,M,,*40
$GPGGA,035938.00,3906.1448,N,11709.5060,E,1,09,0.9,30.14,M,-8.80,M,,*4B
$GPGGA,035938.50,3906.1448,N,11709.5060,E,1,09,0.9,30.16,M,-8.80,M,,*4C
$GPGGA,035939.00,3906.1448,N,11709.5060,E,1,09,0.9,30.15,M,-8.80,M,,*4B
$GPGGA,035939.50,3906.1447,N,11709.5060,E,1,09,0.9,30.20,M,-8.80,M,,*47 展开
1个回答
展开全部
fid=fopen('data.txt');
data=textscan(fid,'%*s %f %f %*s %f %*s %f %f %f %f %*s %f %*s %*s %*s',...
'delimiter',',');
format long
data0=cell2mat(data)
format short
data=textscan(fid,'%*s %f %f %*s %f %*s %f %f %f %f %*s %f %*s %*s %*s',...
'delimiter',',');
format long
data0=cell2mat(data)
format short
更多追问追答
追问
厉害,执行的很好,可以问一下,这个得到的是矩阵吗,可以直接使用任意的一行或者一列吗
追答
是的,你可以试一下
有问题欢迎追问,满意请采纳,谢谢!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询