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

Bob Thompson
Bob Thompson 2019년 3월 13일
What exactly is your question?
Before the loop:
cusformat = {};
Inside the loop:
cusformat{end+1} = [l f];
bsta
bsta 2019년 3월 13일
Thank you

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

제품

릴리스

R2017a

태그

질문:

2019년 3월 13일

댓글:

2019년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by