Filter löschen
Filter löschen

Textscan

8 Ansichten (letzte 30 Tage)
Haris Hameed
Haris Hameed am 14 Mai 2012
Hi
i am using text scan to read number 0012 but it is only reading it as 12.
fid1=fopen('input.dat','r') C=textscan(fid1,'%f',1); fclose(fid1);
i am using text scan as shown above.
Actually i want this number to be read as string. so right now i read the number and convert it to string. so any suggesstions in this case.
hope i have explained the question well

Akzeptierte Antwort

Thomas
Thomas am 14 Mai 2012
try
fid1=fopen('input.dat','r');
C=textscan(fid1,'%s');
fclose(fid1);
%Edit
out=cell2mat(C{1}) % this is ur string displayed
  4 Kommentare
Jan
Jan am 14 Mai 2012
The quote characters are not part of the data, but only displayed in the command window, if a cell is printed, which contains strings.
Haris Hameed
Haris Hameed am 14 Mai 2012
got it ! thankx

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by