Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: copy and rename ascii files
Replies: 2   Last Post: Jul 29, 2011 3:46 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Peter Schreiber

Posts: 110
Registered: 2/1/08
copy and rename ascii files
Posted: Jul 29, 2011 3:37 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello,
I'm trying to copy text (ascii) files and rename them. The filenames
are called

proj_1_XXX_measure.tu
proj_2_XXX_measure.tu
proj_3_XXX_measure.tu
...

and I want to obtain the same files with the changed name like

proj_1_XXX_interpolated.tu
proj_2_XXX_interpolated.tu
proj_3_XXX_interpolated.tu

I've tried the following so far, but with limited success. Can anyone help?
The code that I have generates a file with the desired name, but the file is empty.

Best Regards,
Peter

filesStruct = dir('*.la');
files = {filesStruct.name};
temp = textread(files{1}, '%s', 'whitespace', '');
temp_name1 = files{1};
temp_name2 = [temp_name1(1:end-11) 'interpolatet.tu'];
fid = fopen(temp_name2, 'wt');
fprintf(fid, '%s', temp);
fclose(fid)




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.