so I have a file customers.txt with names in the order of first to last such as
jones, juanita
ant, adam
and I need to reverse them and store into a variable custformat in the order of
juanita jones
adam ant
this is what i have so far
fid=fopen('customers.txt');
while feof(fid)==0
c=fgetl(fid);
[f b]=strtok(c,',');;
l=[b(3:end) ' '];
cusformat=[l f]
end

3 commentaires

Bob Thompson
Bob Thompson le 13 Mar 2019
What exactly is your question?
Walter Roberson
Walter Roberson le 13 Mar 2019
Before the loop:
cusformat = {};
Inside the loop:
cusformat{end+1} = [l f];
bsta
bsta le 13 Mar 2019
Thank you

Connectez-vous pour commenter.

Réponses (0)

Produits

Version

R2017a

Tags

Question posée :

le 13 Mar 2019

Commenté :

le 13 Mar 2019

Community Treasure Hunt

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

Start Hunting!

Translated by