doubt regarding textscan

4 次查看(过去 30 天)
hello friends i want to read a file which contains a long number and i have to store in for further processing, ex 2.6300000000000000e+002 2.2500000000000000e+002() like this . i think it is a exp data ,i tried using textscan(fid,'%f %f')but no result i am waiting for ur help

采纳的回答

per isakson
per isakson 2012-5-24
What do you mean by "no result"? What value does fid have? This little test works fine!
str = '2.6300000000000000e+002 2.2500000000000000e+002';
cac = textscan( str,'%f %f');
>> cac{:}
ans =
263
ans =
225
  3 个评论
Walter Roberson
Walter Roberson 2012-5-28
What result do you get from textscan() ? Do you get an error message?
muthu kumar
muthu kumar 2012-5-28
thank u i got it
the code is
function [c]= file11(arg)
fi=fopen(arg,'r');
c=textscan(fi,'%f %f');
fclose(fi);
main file is
fid = fopen('test.txt');
tline = fgetl(fid);
k=1;
images = cell(1, 2);
while ischar(tline)
disp(tline)
images{k}= file11(tline);
k=k+1;
tline = fgetl(fid);
end
disp([images{:}]);
fclose(fid);
it reads given no of files and it stores the contents in cell array
thank for ur guidence

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Large Files and Big Data 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by