The following is my code. I seem to not be able to write the code into the phone.txt file. can anyone tell me where my error is? phonenos.csv is an file with 3 lines of 10 digits, reminiscent of a phone number without the dashes or parentheses. this code will write them into the format (xxx) xxx-xxxx
format long gfid=fopen('phonenos.csv','r');fid2=fopen('phone.txt','w');for i=1:3 phonenos=fgetl(fid); area=phonenos(1:3); next3=phonenos(4:6); last4=phonenos(6:9); phonenos=['(' area ') ' next3 '-' last4];endclose=fclose(fid);close2=fclose(fid2);type phone.txt
Best Answer