extracting info from edit text gui
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
[EDIT: 20110625 - reformat - WDR]
Please help me with this
function [] = clear_edit_example()
% Show how to clear and editbox string when cursor is placed over it.
S.fh = figure('units','pixels',...
'position',[500 500 300 50],...
'menubar','none',...
'numbertitle','off',...
'name','clear_edit_example',...
'resize','off');
S.ed = uicontrol('style','edit',...
'units','pixels',...
'position',[10 10 280 30],...
'fontsize',14,...
'string','Enter Value');
set(S.fh,'windowbuttonmotionfcn',{@fh_bmfcn,S})
This is the code and i want to use the data of editbox externally for some other purpose... someone please help me with this...
0 commentaires
Réponses (1)
Arturo Moncada-Torres
le 24 Juin 2011
To extract the data (text) from the edit box, you will need something more or less like this:
% Get the string from the editText box.
myText = get(S.ed, 'String');
EDIT
When you run a GUI, the variables' scope is only within the GUI. If you want to be able to manipulate that variable later, save the variable into a .mat file and load it later. For example:
% Get the string.
myText = get(S.ed, 'String');
% Save the variable into a .mat file.
save('myTextVariable', 'myText');
Later, to recover it:
% Load the variable for later use.
load('myTextVariable', 'myText');
Try it and let me know if it works ;-)
2 commentaires
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!