MATLAB Answers

How I can send data from a pushbutton to an edit box in GUI for mak an interface phone.

10 views (last 30 days)
ALEX
ALEX on 5 Oct 2017
Edited: Niels on 5 Oct 2017
I am making a project of a DTMF and I d'ont arrive to send a value in a edit box.
For information I have a keypad with 12 push button. Each button send frenquency to different function for draw different curve and make the noise of the keyboard key.
But I want a screen where I can see what i have pressed.
So i share my code in the hope that someone can help me.
I have try lot of thing:
  • Create a table (matrix [1:10]) and read this one.
  • Send the value and shift it a left.
  • Count in gray code
  • define a variable for increment the power of 10 and add at a variable result
  • Send to an excel and read it.
  • Send to an text and read it.
I do not arrive to print a numer.......
HELP PLEASE
function varargout = Pad(varargin)
% PAD MATLAB code for Pad.fig
% PAD, by itself, creates a new PAD or raises the existing
% singleton*.
%
% H = PAD returns the handle to a new PAD or the handle to
% the existing singleton*.
%
% PAD('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PAD.M with the given input arguments.
%
% PAD('Property','Value',...) creates a new PAD or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Pad_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Pad_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help Pad
% Last Modified by GUIDE v2.5 04-Oct-2017 23:05:18
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Pad_OpeningFcn, ...
'gui_OutputFcn', @Pad_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before Pad is made visible.
function Pad_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Pad (see VARARGIN)
% Choose default command line output for Pad
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Pad wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Pad_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in Bouton1.
function Bouton1_Callback(hObject, eventdata, handles)
% hObject handle to Bouton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1209;
cf=697;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton2.
function Bouton2_Callback(hObject, eventdata, handles)
% hObject handle to Bouton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1336;
cf=697;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton3.
function Bouton3_Callback(hObject, eventdata, handles)
% hObject handle to Bouton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1477;
cf=697;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton4.
function Bouton4_Callback(hObject, eventdata, handles)
% hObject handle to Bouton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1209;
cf=770;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton5.
function Bouton5_Callback(hObject, eventdata, handles)
% hObject handle to Bouton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1336;
cf=770;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton6.
function Bouton6_Callback(hObject, eventdata, handles)
% hObject handle to Bouton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1477;
cf=770;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton7.
function Bouton7_Callback(hObject, eventdata, handles)
% hObject handle to Bouton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1209;
cf=852;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton8.
function Bouton8_Callback(hObject, eventdata, handles)
% hObject handle to Bouton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1336;
cf=852;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton9.
function Bouton9_Callback(hObject, eventdata, handles)
% hObject handle to Bouton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1477;
cf=852;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in BoutonDiez.
function BoutonDiez_Callback(hObject, eventdata, handles)
% hObject handle to BoutonDiez (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1209;
cf=941;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in Bouton0.
function Bouton0_Callback(hObject, eventdata, handles)
% hObject handle to Bouton0 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
lf=1336;
cf=941;
axes(handles.axes1);
PlayFr( lf,cf,Fe,Amp );
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on button press in BoutonEtoile.
function BoutonEtoile_Callback(hObject, eventdata, handles)
% hObject handle to BoutonEtoile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fe = 8000; % Fréquence d'échantillonnage à 8kHz
Amp = 0.5;
lf=1477;
cf=941;
axes(handles.axes1);
PlayFr( lf,cf, Fe )
axes(handles.axes2);
PlayFr2( lf,cf,Fe,Amp );
axes(handles.axes3);
PlayFr3( lf,cf,Fe,Amp );
axes(handles.axes4);
PlayFr4( lf,cf,Fe,Amp );
axes(handles.axes5);
PlayFr5( lf,cf,Fe,Amp );
set(handles.Amplitude,'string',num2str(Amp));
set(handles.NumberSample,'string',num2str(Fe));
guidata(hObject, handles);
% --- Executes on mouse press over axes background.
function axes2_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject, handles);
% --- Executes on mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject, handles);
% --- Executes on mouse press over axes background.
function axes3_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject, handles);
% --- Executes on mouse press over axes background.
function axes4_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject, handles);
% --- Executes on mouse press over axes background.
function axes5_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject, handles);
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
guidata(hObject, handles);
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over edit1.
function edit1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function text4_CreateFcn(hObject, eventdata, handles)
% hObject handle to text4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
guidata(hObject, handles);
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
guidata(hObject, handles);
% --- Executes on key press with focus on edit2 and none of its controls.
function edit2_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)
guidata(hObject, handles);
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
Valeur = get(hObject,'Value');
set(handles.ValueSlider,'String',num2str(Valeur));
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function ValueSlider_Callback(hObject, eventdata, handles)
% hObject handle to ValueSlider (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of ValueSlider as text
% str2double(get(hObject,'String')) returns contents of ValueSlider as a double
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function ValueSlider_CreateFcn(hObject, eventdata, handles)
% hObject handle to ValueSlider (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
guidata(hObject, handles);
function NumberSample_Callback(hObject, eventdata, handles)
% hObject handle to NumberSample (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of NumberSample as text
% str2double(get(hObject,'String')) returns contents of NumberSample as a double
% --- Executes during object creation, after setting all properties.
function NumberSample_CreateFcn(hObject, eventdata, handles)
% hObject handle to NumberSample (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Amplitude_Callback(hObject, eventdata, handles)
% hObject handle to Amplitude (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Amplitude as text
% str2double(get(hObject,'String')) returns contents of Amplitude as a double
% --- Executes during object creation, after setting all properties.
function Amplitude_CreateFcn(hObject, eventdata, handles)
% hObject handle to Amplitude (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Phase_Callback(hObject, eventdata, handles)
% hObject handle to Phase (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Phase as text
% str2double(get(hObject,'String')) returns contents of Phase as a double
% --- Executes during object creation, after setting all properties.
function Phase_CreateFcn(hObject, eventdata, handles)
% hObject handle to Phase (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

  5 Comments

Show 2 older comments
Niels
Niels on 5 Oct 2017
Hi Alex,
you can upload your GUI's .fig and .m file + other necessary functions.
I dont think anyone is able to use the "code" given above
Jan
Jan on 5 Oct 2017
@Alexandre: Do you see that your code is not readable? It cannot be run also, because the messed up formatting prevents this.
Nobody can read your code. But even if you use the "{} Code" button to format your code (please learn how to use it), it is far too much code. Concentrate on the problem. Post only the code, which is relevant for your problem. The screenshot does not help also.
I do not understand, what your question is and what this list of activities means:
  • Create a table (matrix [1:10]) and read this one.
  • Send the value and shift it a left.
  • Count in gray code
  • define a variable for increment the power of 10 and add at a variable result
  • Send to an excel and read it.
  • Send to an text and read it. I do not arrive to print a numer
None of these points can be reconsidered. E.g. "Send to an Excel"?
I suggest to remove the pile of code. Then explain clearly, what " want a screen where I can see what i have pressed" means. What is "a screen"? Where should appear what in which form?

Sign in to comment.

Answers (3)

Niels
Niels on 5 Oct 2017
Edited: Niels on 5 Oct 2017
>> I am making a project of a DTMF and I d'ont arrive to send a value in a edit box. <<
NB of Samples and Amplitude are also edit fields, how did you make the values appear in there?
Either i did get your question wrong or it is not your gui.
-----
In general: open the gui with 'guide'-> you create an edit box , open property manager ->
name its 'Tag' (ex. 'buttonpressed') and clear the String -> go to each button's callback function and type
handles.buttonpressed.String = hObject.String;
this is how the buttons string (=the one you can see on top of each button) will be visible in your editbox
analogically for a textbox

  3 Comments

Niels
Niels on 5 Oct 2017
if you want to enter a cerrtain number use: num2str
handles.buttonpressed.String = num2str(anyNumberOrMatrix);
Niels
Niels on 5 Oct 2017
>> Thank you for this answers but i don't want see the phone number digit per digit i wanna see all number. So it is possible to enter ce variable to the first first box of an array and shift the box's set ? I want to print the phone number in real time <<
just add strcat then:
handles.buttonpressed.String = strcat(handles.buttonpressed.String, hObject.String);
in this case you should also add a 'clear' button
Niels
Niels on 5 Oct 2017
you can change the order of the pressed buttons by switching the input arguments of strcat

Sign in to comment.


ALEX
ALEX on 5 Oct 2017
Thank you for this answers but i don't want see the phone number digit per digit i wanna see all number. So it is possible to enter ce variable to the first first box of an array and shift the box's set ? I want to print the phone number in real time .

  0 Comments

Sign in to comment.


ALEX
ALEX on 5 Oct 2017
And I don't find how to create a global var for use in the whole code. I use function with if condition but I want to know how to declare a global var.

Sign in to answer this question.