if you just need to concatenate a number use something like:
newname=[ basename, int2str(num) ];
for basename= 'file' and num= 42 this will result in
newname= 'file42'
If you need to do more complicated formating of the number, the
sprintf()-function may be worth a look. It works like in C.
Regards,
Andre
- --
Andre Vehreschild -- Institute for Scientific Computing, Aachen University
mailto: , phone: ++49- 241- 80- 24874
GnuPG-key available at http://www.sc.rwth-aachen.de/vehreschild
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
Try using the eval command (u might have to use num2str as an arguement
inside
the eval command)
malcolm_graham2002 <> wrote: Does anyone know
of an easy way (or any way) of manipulating m-file
names using a matlab function.
As a simple example: say I have a Simulink model which runs the m-
file 'file1.m'. Now I also have three other files
called 'file2.m', 'file3.m' and 'file4.m'. What I
want to do is
somehow create a loop which runs the simulink model with file1, then
file2, then file3, etc., without manually changing the filename in
Simulink each time (eg. let's say I have 100 files!).
Any ideas?
Thanks,
Mal
_____________________________________
Note: If you do a simple "reply" with your email client, only the
author of this
message will receive your answer. You need to do a "reply all" if you
want your
answer to be distributed to the entire group.
_____________________________________
About this discussion group:
Reply by malcolm_graham2002●July 5, 20022002-07-05
Does anyone know of an easy way (or any way) of manipulating m-file
names using a matlab function.
As a simple example: say I have a Simulink model which runs the m-
file 'file1.m'. Now I also have three other files
called 'file2.m', 'file3.m' and 'file4.m'. What I
want to do is
somehow create a loop which runs the simulink model with file1, then
file2, then file3, etc., without manually changing the filename in
Simulink each time (eg. let's say I have 100 files!).