Giving names to different files automatically
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi sorry for the "silly " question , but i have a pretty large script written and i am trying to make a bit more functional i have several hundreds variables that repeat themselves into multiple files so i would like to use the command style fname = 'name_given' and then have something like these throughout the file but with fname as first component and A, B, C ,D etc as the secondary naming components.
fname = 'new'
fname+A = VarName ===> fname_A (getting out something like this)
any ideas please?
0 Kommentare
Antworten (2)
Jos (10584)
am 8 Jul. 2014
Rethink your programming style critically. The basic idea about variables is that their contents change during execution of the code, and not their names…
Jos (10584)
am 8 Jul. 2014
Maybe you can use structures?
MyStructure.A = 8 ;
MyStructure.B = 1:5 ;
MyField = 'A'
result = 2 * MyStructure.(MyField)
0 Kommentare
Siehe auch
Kategorien
Mehr zu File Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!