From: Maxx on
Perhaps is there a setappdata command I can utilize?
From: Steven Lord on

"Maxx " <chatskom(a)chemimage.com> wrote in message
news:i0d7j8$kc9$1(a)fred.mathworks.com...
> "Matt Fig" <spamanon(a)yahoo.com> wrote in message
> <i0d6rd$1vc$1(a)fred.mathworks.com>...
>> You do not need to edit the property inspector. Somewhere in your code
>> is the line that updates your cell array. Right after that line, use the
>> SET function update the string.
>
> Sorry Matt I do not follow. The part of my code is
>
> % --- Executes on selection change in listbox1.
> function listbox1_Callback(hObject, eventdata, handles)
>
> %def_path=path(newpath,'\\Kiryu\public\ApplicationScience\Spectral
> Library\Documents')
>
> [num,data_excel]=xlsread('Book2.xlsx','Sheet1','A2:D1000');
> substance=data_excel(:,1);
> I WANT THIS TO APPEAR IN THE LISTBOX UPON OPENING, NOT "Default text"

Then you're too late. Note the comment just before the function
declaration:

> % --- Executes on selection change in listbox1.

What you would want to do is run this code in the CreateFcn for the listbox.
I would in fact put all this code in a function that accepts the handle of
the listbox to update and call that separate function from both the
CreateFcn and the Callback function.

Since you're doing this in GUIDE, you may need to change the CreateFcn
property in the Property Inspector to force GUIDE to give you the prototype
of the CreateFcn in your file.

http://www.mathworks.com/support/solutions/en/data/1-4GA0LM/?solution=1-4GA0LM

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Maxx on
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Ooo nice catch. Right so its like the directory listbox example on the Mathworks website then. I would have to run the function under OpeningFcn for the gui, and specify it on its own in the code right?
From: Maxx on
Also,
I was receiving the following error message:
Warning: single-selection listbox control requires that Value be an integer within String range control will not be rendered until all of its parameter values are valid.
I read up on it and the solution is the set(handle,'value',1) command. However, this just returns the first item in my cell array (because its recognized as value=1). When I edit the set(h,value) in and out of the different functions it either displays the warning or goes to the first value....
Maxx
From: Maxx on
Sorry! This problem was solved in a previous post. Thanks for your help
 |  Next  |  Last
Pages: 1 2
Prev: Reading Excel Data into a list box
Next: PIL and PWM