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?

generating a variable name using a file name selected

Asked by Asl

Asl (view profile)

on 20 Oct 2013
Latest activity Edited by Image Analyst

Image Analyst (view profile)

on 20 Oct 2013

Hallo, I select a file >>>> ABC.xls [FileName,wfolder] = uigetfile({'*.xlsx'});

FileName returns the name of the file >>>> ‘ABC.xls’ I want to use the name of the file as a part of a variable name. Veriable >>>>> A = [1 2 4 7 ] I want to generate a a new variable A_ABC and assign it a vales of A A_ABC = [1 2 4 7 ] How can I do this? Thanks

0 Comments

Asl

Asl (view profile)

Products

No products are associated with this question.

1 Answer

Answer by Image Analyst

Image Analyst (view profile)

on 20 Oct 2013
Edited by Image Analyst

Image Analyst (view profile)

on 20 Oct 2013

You'd have to use dynamic structure names: http://www.mathworks.com/matlabcentral/answers/32416#answer_40979, or use eval() though eval is usually recommended against.

0 Comments

Image Analyst

Image Analyst (view profile)

Contact us