MATLAB: [GUI] Importing Data from an array of strings

data importguiimportdatalistbox

I have an array of strings:
listboxItems = cellstr( get(handles.listbox_dat, 'string') );
The array is a list of .dat files. "something.dat,etc.dat…"
I want to import a certain .dat file which for the purpose of this question is the value "a" in the array.
When I type the following it says "unable to open file"
importer = importdata(listboxItems(a));
The file is in the Matlab folder and I am able to import it via the main matlab command window. I also check with the aid of a "static text" to show listboxItems(a) with the following:
set(handles.text1,'string',listboxItems(a))
which shows "something.dat" and yet the next line that asks for that data to be imported it is unable to open the file. Because of the error I know that the string is "something.dat" and not just "something"
Anyways any help is greatly appreciated.
Thanks, Shane

Best Answer

importer = importdata(listboxItems{a}); %note {}
Related Question