A little background info: in a Matlab GUI, I load the files from a directory into a listbox. I have a structure with 8 possible file names and the "display name" that each filename maps to. This display name is what is populated in the listbox.
label{1,1}=file1.csvlabel{1,2}=Display 1label{2,1}=file2.csvlabel{2,2}=Display 2
With the following code, I am trying to determine which files are selected, determine the actual file name, and load the files into an originally empty data structure.
data{1,8}={};
for i=1:length(index_selected) for j=1:8 %8 possible files
if strcmp(handles.list_names{index_selected(i)},labels{j,2})==1 if isempty(data{j})==1 fid=fopen(labels{j,1}); data{j}=textscan(fid,'%s%s%u%f%f%f%f%u','Delimiter',',',... 'HeaderLines',1); fclose(fid); end end endend
I know strcmp isn't going to work as I have it, but it illustrated what I'm going for. The main thing I am struggling with is how to get a string of the display name of a selected index.
Best Answer