How do I change this to produce the desired value in the box?

1 view (last 30 days)
-

Answers (1)

Geoff Hayes
Geoff Hayes on 30 Jul 2016
Reetahan - since you haven't attached your figure, it is difficult for us to visualize what your GUI looks like. What are the ten boxes? What is the final box? At what point is the bit rate calculated?
I see that for each edit control you have a callback that extracts the string text and converts it into a number as
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
PT_dBm = str2double(get(hObject,'String'));
This is "fine", but your (in this case) PT_dBm is a local variable only and will not be accessible from within any other callback. If you are simply extracting the numeric data from the string (and not doing any manipulation) then I would defer this task until the user presses the pushbutton
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
PT_dBm = str2double(get(handles.edit1,'String'));
Gt_dBi = str2double(get(handles.edit2,'String'));
% etc.
Then do your calculation and update the text control for the bit rate.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!