texscan multiple variables

14 vues (au cours des 30 derniers jours)
Chiara Modenese
Chiara Modenese le 21 Mar 2011
Hello, I use texscan as something like
d = cell2mat(textscan(fid, '%f %f %f'));
My problem is that I have many variables of type f, say 30 of them, and I want somehow to input the number which indicates how many of them I need rather than typing %f %f %f %f %f etc. etc. every time. Any hint?
Chiara

Réponse acceptée

Matt Tearle
Matt Tearle le 21 Mar 2011
fmt = repmat('%f',1,30);
d = cell2mat(textscan(fid,fmt));

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by