Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Renaming file name with variable.

Asked by ZK

ZK (view profile)

on 16 Jan 2013

Hi i would like to rename or save as new file, generated by:

fid = fopen('TempFile.htm','w');

In the name of new file I would like to use variable

e = 20120319 (saved as a char)

so the new file should look like this

20120319.htm

Do you have any ideas?

Thank You

0 Comments

ZK

ZK (view profile)

Tags

Products

1 Answer

Answer by Pedro Villena

Pedro Villena (view profile)

on 16 Jan 2013
Accepted answer
 e = '20120319';
 copyfile('TempFile.htm',[e '.htm']);

1 Comment

ZK

ZK (view profile)

on 16 Jan 2013

Thank You, works perfect.

Pedro Villena

Pedro Villena (view profile)

Contact us