Error using textscan Unknown option '%f'
Afficher commentaires plus anciens
filename = 'Temp1.csv'
fileid = fopen(filename);
C = textscan(fileid,'%s',32,'%f',32,'delimiter',';');
Error using textscan
Unknown option '%f'
Why is this giving me such an error? %f is one of the formatspec in textscan. Then why is it giving me such an error.
Réponses (1)
Star Strider
le 14 Jan 2019
I have no idea what you want to do.
Perhaps this:
C = textscan(fileid, '%s %f ', 'delimiter',';');
I added a space for each ‘32’ (the ASCII numerical code for a space), since I assume you intend that.
3 commentaires
Govind Sankar Madhavan Pillai Ramachandran Nair
le 14 Jan 2019
@Govind Sankar Madhavan Pillai Ramachandran Nair: neither the formatspec nor the N repeat. They each occur only once (N is optional), e.g.:
textscan(fileid, '%f%f%f', 4)
The format spec is usually written to match one whole line of the data file, while N is usually used to control how many lines of data are imported.
I suggest that you look at some of the documentation examples of how to use textscan, in particular taking a good look at examples of the format spec. You will find many examples just under the title Examples. Read them carefully.
Star Strider
le 14 Jan 2019
@Stephen — Thank you. I was ‘away’ for the last few minutes, responding to another Question.
Catégories
En savoir plus sur Large Files and Big Data dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!