MATLAB Answers


generating a variable name using a file name selected

Asked by Asl
on 20 Oct 2013
Latest activity Edited by Image Analyst
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



No products are associated with this question.

1 Answer

Answer by Image Analyst
on 20 Oct 2013
Edited by Image Analyst
on 20 Oct 2013

You'd have to use dynamic structure names:, or use eval() though eval is usually recommended against.


Join the 15-year community celebration.

Play games and win prizes!

Learn more
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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!