After the user selects some entries from a listbox, what is the "matlab" way of creating an array that will have all the selected items? There is, of course, the straightforward procedural approach of building it of the array that is returned, and there is a way of building a boolian array with "1" at the selected entries (by looping over the returned array) and than doing something like:
FileList=FileList(BoolArray>0)
which is working allright, but I have a strong feeling there is a better way of doing it with MATLAB, since that "looping over the returned array" seems to be crying to be changed.
BTW, in the above example trying to use the boolian array without the ">0" – i.e. FileList=FileList(BoolArray) – generates a syntax error, which is probably avoidable somehow…?
Best Answer