Reading a string with %
Ältere Kommentare anzeigen
Hello,
I am trying to read in a list of strings from a .xls file, some of which contain a %. Since this is generally used to add comments to a block of code, the stings that contain %'s are being read into MATLAB as ''. Is there any way to read these strings into MATLAB so that they include the %? For example
'hello%mynameis'
, or should I just scrap them from my list?
Many Thanks, Charlie
1 Kommentar
Please post your current code. Why do you assume that the % characters are not imported? Did you check this by something like this:
s = 'hello%mynameis'
fprintf(s)
Then try:
fprintf('%s', s)
Akzeptierte Antwort
Weitere Antworten (1)
dpb
am 13 Okt. 2014
You don't give any other information on what you tried, but there's no reason you can't read such strings into Matlab...
>> l='hello%mynameis';
>> textscan(l,'%s')
ans =
{1x1 cell}
>> ans{1}
ans =
'hello%mynameis'
>>
What specific file format did you have and what specific problem did you have with reading it with what specific statement/function?
1 Kommentar
Charlotte
am 13 Okt. 2014
Kategorien
Mehr zu Text Files finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!