***************
d = dir;
str = {d.name};
[s,v] = listdlg (' PromptString', 'Select a file:' ...
' SelectionMode', 'multiple',
... %single,
multiple -Selection Mode is possible
'ListString' str)
***************
My filelist:
abc.dat
xyz.dat
aa.dat
....
...etc.
Running the example brings out the selection box so that I choose some
files (e.g. second, third). As a result I get
Selection: s = [2 3]
ok: v = [1]
My Question is how I can utilize this information to load these selected
files ?
If it is not possible do you know any other way ??
Hope somebody can help me
Thanks
Robert
You can use the values returned in s to index into the str cell:
[s,v] = listdlg(......)
if v
for i = 1:length(s)
load( str{i} );
end
end
Hope that helped,
Jordan
"Robert Nemec" <robn...@linux.zrz.TU-Berlin.DE> wrote in message
news:3933A0AC...@linux.zrz.TU-Berlin.DE...
When I choose e.g the last two files (s=[4 5] v= [1])
the programm gives out the first two files.
I think that means that the procedure uses just the number of elements
of "s"
and not its values isn't it ?
For loading the selected files I need access to each element of "s".
The highest value of "s" is set to "i".
When the loop starts the counter has to be compared with each element of
"s".
When the value of the counter is equal with an element of "s" the file
is given
out.
What do you think about this way, is it possible ?
If there is no solution I try to avoid this problem in using your
procedure to load the list of all my selected *.dat files in an extra
path (That works very well !!!).
Thanks a lot for your help Jordan.
Robert
PS:I hope my description was clear
Whoops, there was a mistake in the code I wrote. It should be:
d = dir;
str = {d.name};
[s,v] = listdlg('promptstring','select a
file:','selectionmode','multiple','liststring',str)
if v
for i = 1:length(s)
load( str{ s(i) } );
end
end
I had mistakenly used str{i} instead of str{s(i)}. I guess you could take
advantage of Matlab's generalized FOR loops and write it this way as well:
d = dir;
str = {d.name};
[s,v] = listdlg('promptstring','select a
file:','selectionmode','multiple','liststring',str)
if v
for idx = s
load( str{ idx } );
end
end
Hope that helped,
Jordan
<robn...@linux.zrz.tu-berlin.de> wrote in message
news:3937DC65...@linux.zrz.tu-berlin.de...
Robert
Hello everyone, I am currently working on this project, where I utilized listdlg for user to make selection. I am using single selection, but I faced problem in writing callback function. I get this error:Error while evaluating uicontrol Callback.
I am wondering how I can get the information from user's selection(images from computer files) and display it in axes.
Thanks in advance :):):)