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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Steve
on 17 May 2013

I have a list of some 500+ variable names in Excel. What I want to do is to turn them all into strings so I can use them in Matlab. Is there a way I can import the names in as a string without having to add ' ' around each entry?

*No products are associated with this question.*

Answer by Image Analyst
on 17 May 2013

[numbers, variableNameStrings, raw] = xlsread(fullFileName);

variableNameStrings should be a cell array with all your strings in it. See the FAQ for an explanation of cell arrays: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F

## 3 Comments

## per isakson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76172#comment_149536

Did you make some experiments with

xlsread? It shouldn't be a problem?## Matt Kindig (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76172#comment_149537

Are you importing them using xlsread()? If so, the '' should not be necessary.

If you are just copy-pasting the names into Matlab, why not add a formula (in Excel) concatenating the '' to the variable name, using the CONCATENATE() function in Excel?

## David Barry (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/76172#comment_149580

If you don't want to import automatically then you can just create an empty cell array and paste the excel data straight in.