資源簡介
讀取txt文件內(nèi)容matlab代碼實現(xiàn)。本資源中包括了.txt測試文檔和matlab代碼示例。
代碼片段和文件信息
clear?all;
close?all;
clc;
ffid_ERS?=?fopen(‘circleCenter_ERS.txt‘‘r‘);
%輸入數(shù)據(jù):ffid
ffid?=?ffid_ERS?;
%輸出數(shù)據(jù):XYRtO?imgName
%讀入.txt文件數(shù)據(jù)到cell對象中
i?=?0;
tline1?=?cell(1001);%定義cell對象
while?feof(ffid)?==?0
????i?=?i+1;
????tline1{i1}?=?fgetl(ffid);
????%??????tline?=?fgetl(ffid);
end
numImg=i;
imgName?=?cell(numImg1);
XYRtO???=?zeros(numImg5)?;
%從cell讀寫中讀入數(shù)據(jù)到特定的數(shù)據(jù)變量
for?i=1:numImg
????tline=tline1{i1}?;
????[XYRtO(i1)?XYRtO(i2)?XYRtO(i3)?XYRtO(i4)?XYRtO(i5)?imgName{i1}]...
????????=?strread(tline‘%d?%d?%d?%d?%d?%s‘);
end
%輸出數(shù)據(jù)
imgName_ERS?=?imgName;
XYRtO_ERS???=?XYRtO;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????664??2017-10-09?18:59??analysiseLocation.m
?????文件????????282??2017-10-09?15:50??circleCenter_ERS.txt
-----------?---------??----------?-----??----
??????????????????946????????????????????2
評論
共有 條評論