f



Getting output from MATLAB GUI (edit text)

Hello guys, I've been trying to figure out what's wrong with the GUI (presented below) when I try to get the text inserted in 5 different edit textboxes. When I run the command: 

[a,b,c,d,e] = GUI_input_parameter

I get the following error: 

Attempt to reference field of non-structure array.

Error in GUI_input_parameter>GUI_input_parameter_OutputFcn (line 74)
varargout{1} = handles.data1;

Error in gui_mainfcn (line 263)
        [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);

Error in GUI_input_parameter (line 40)
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});


________________________________________________________
The GUI '.m' code is presented below:

function varargout = GUI_input_parameter(varargin)
% GUI_INPUT_PARAMETER MATLAB code for GUI_input_parameter.fig
%      GUI_INPUT_PARAMETER, by itself, creates a new GUI_INPUT_PARAMETER or raises the existing
%      singleton*.
%
%      H = GUI_INPUT_PARAMETER returns the handle to a new GUI_INPUT_PARAMETER or the handle to
%      the existing singleton*.
%
%      GUI_INPUT_PARAMETER('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GUI_INPUT_PARAMETER.M with the given input arguments.
%
%      GUI_INPUT_PARAMETER('Property','Value',...) creates a new GUI_INPUT_PARAMETER or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before GUI_input_parameter_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to GUI_input_parameter_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 GUI_input_parameter

% Last Modified by GUIDE v2.5 26-Nov-2014 15:33:59

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GUI_input_parameter_OpeningFcn, ...
                   'gui_OutputFcn',  @GUI_input_parameter_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 GUI_input_parameter is made visible.
function GUI_input_parameter_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 GUI_input_parameter (see VARARGIN)

% Choose default command line output for GUI_input_parameter
handles.output = hObject;


% Update handles structure
guidata(hObject, handles);

% UIWAIT makes GUI_input_parameter wait for user response (see UIRESUME)
uiwait(hObject);


% --- Outputs from this function are returned to the command line.
function varargout = GUI_input_parameter_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.data1;
varargout{2} = handles.data2;
varargout{3} = handles.data3;
varargout{4} = handles.data4;
varargout{5} = handles.data5;

% The figure can be deleted now
delete(hObject);

% --- Executes on button press in start_button.
function start_button_Callback(hObject, eventdata, handles)
% hObject    handle to start_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

handles.data1 = get(handles.L_start_input,'String');
handles.data2 = get(handles.L_end_input,'String');
handles.data3 = get(handles.M_start_input,'String');
handles.data4 = get(handles.M_end_input,'String');
handles.data5 = get(handles.M_target_input,'String');

guidata(hObject, handles);
close(handles.figure1);


function M_start_input_Callback(hObject, eventdata, handles)
% hObject    handle to M_start_input (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 M_start_input as text
%        str2double(get(hObject,'String')) returns contents of M_start_input as a double

 

% --- Executes during object creation, after setting all properties.
function M_start_input_CreateFcn(hObject, eventdata, handles)
% hObject    handle to M_start_input (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 M_end_input_Callback(hObject, eventdata, handles)
% hObject    handle to M_end_input (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 M_end_input as text
%        str2double(get(hObject,'String')) returns contents of M_end_input as a double


% --- Executes during object creation, after setting all properties.
function M_end_input_CreateFcn(hObject, eventdata, handles)
% hObject    handle to M_end_input (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 M_target_input_Callback(hObject, eventdata, handles)
% hObject    handle to M_target_input (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 M_target_input as text
%        str2double(get(hObject,'String')) returns contents of M_target_input as a double


% --- Executes during object creation, after setting all properties.
function M_target_input_CreateFcn(hObject, eventdata, handles)
% hObject    handle to M_target_input (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 L_start_input_Callback(hObject, eventdata, handles)
% hObject    handle to L_start_input (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 L_start_input as text
%        str2double(get(hObject,'String')) returns contents of L_start_input as a double



% --- Executes during object creation, after setting all properties.
function L_start_input_CreateFcn(hObject, eventdata, handles)
% hObject    handle to L_start_input (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 L_end_input_Callback(hObject, eventdata, handles)
% hObject    handle to L_end_input (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 L_end_input as text
%        str2double(get(hObject,'String')) returns contents of L_end_input as a double

% --- Executes during object creation, after setting all properties.

function L_end_input_CreateFcn(hObject, eventdata, handles)
% hObject    handle to L_end_input (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



% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: delete(hObject) closes the figure
% delete(hObject);

if isequal(get(hObject, 'waitstatus'), 'waiting')
    % The GUI is still in UIWAIT, call UIRESUME
    uiresume(hObject);
else
    % The GUI is no longer waiting, just close it
    delete(hObject);
end
0
Matheus
11/26/2014 7:15:07 PM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
679 Views

Similar Articles

[PageSpeed] 0

Reply:

Similar Artilces:

How to save text files in Matlab GUI from edit text box
Dear all, please help me in understanding the usage of GUI. I found on the web a suggested way to write a button callback to read the content of an edit text box and save to a txt file, that is: %save text of command.txt file fid = fopen('command.txt','wt'); fprintf(fid,'%c',get(handles.edit1,'String')) fclose(fid); Anyway, the text in the box is saved in the text file in a wrong and very peculiar way; if I write in the box something like: PALA POLO I find in the command.txt file has been saved the following: PPAOLLAO and I can't manag...

MATLAB GUI-edit text
How to write command in MATLAB GUI so,whenever the user enter value OR number in my EDIT TEXT and after they enter the PUSH BUTTON,the action will automatically plotting my AXES. Says I have a transfer function. TF= (-0.0911+1.554z^-1)/(-1.036z^-1-1+0.036372z^-2) Thanks in advance. "EMELLINE HOLT JANG" wrote in message <ki8u8r$nmc$1@newscl01ah.mathworks.com>... > How to write command in MATLAB GUI so,whenever the user enter value OR number in my EDIT TEXT and after they enter the PUSH BUTTON,the action will automatically plotting my AXES. Says I have a transfer fun...

Copy text from edit text box on MATLAB GUI to specific cell on an excel file
Good day! I would like to copy or transfer the text from an edit box on MATLAB GUI (via push button) to a specific cell on an excel file. Can you suggest on how to accomplish this one or even cite sample codes? If this is not possible, can you suggest anything on how to allow the user to input texts using the MATLAB GUI (via push button) and automatically transfer the texts to a specific cell on excel? It is preferable to have the texts copied/stored to the excel file without opening the actual excel file. Thank you so much. "Mary Requilman" <maryrose.requilman@gmail....

Updating Edit text in MATLAB GUI
Hi, I have a question regarding updating the values in the edit text components of a MATLAB GUI. I have a 'for' loop which does computation on an array of images. I want the image's index which is being processed in the edit text box. So, in each iteration of the loop I do the computation and update the edit text box using: set ( handles.edit2, 'String' , [ 'Processing image number: ', num2str (i) ] ) ; The problem is, the text is not getting updated after each loop, but instead it gets updated at the end after all the iterations are finished. do I need to ad...

text output box in MATLAB GUI?
I want to create a MATLAB GUI with GUIDE and I want one of the components to be a text output box containing many lines of text (wrapped, if possible) that has been generated by the program. As the program proceeds this text is continuously rewritten as the program operates on it and changes it. The user never needs to input text into this box. Is this possible? How do I do it? Thanks. John MAc John Macdonald wrote: > > > I want to create a MATLAB GUI with GUIDE and I want one of the > components to be a text output box containing many lines of text > (wrapped, if possible) tha...

edit text in matlab GUI 7
i'm working on a GUI which can calculate Ohm's Law by inputing any 2 figures of the 3 data in the formula, V=IR. however i was stucked at the m-file editor.. how can i write the command so that any 2 values (for example, current and voltage) inputed in the edit text.. will produce the result (for example, resistance) in the third edit text box after pressing a particular button? i have read through a lot of documents... still have no idea how to start.. thanks in advance.. In article <fciknq$ic$1@fred.mathworks.com>, c ws <theorekz@gmail.com> wrote: >i'm working ...

About setting value for edit-text in Matlab GUI
I created a message panel using edit-test, and name its tag as 'messagePanel'. In the callback function of a button, I want the following sentences being printed through my message panel subsequently, like, function myButton_Callback(hObject, eventdata, handles) msg1 = 'abcde'; set(handles.messagepanel, 'String', msg1); msg1 = 'fghij'; set(handles.messagepanel, 'String', msg2); I assume that msg1 and msg2 should be printed out consecutively, however msg1 was never printed. Could anyone tell me the reason:? Thanks in advance. "YI...

Matlab GUI Edit Text changes background color
Hi. When I created my GUI, I added a few edit text conrols to my form and changed their BackgroundColor from default white to another color. When I ran my program everything was ok - BackgroundColor remained the same as I specified, but then one of edit text conrols was disabled ('Enable', 'off') and after that enabled ('Enable', 'on') and its BackgroundColor magically changed to an unknown color. My question is can I override this color somehow and if yes where can I do it? ...

Matlab GUI: displaying a vector in an edit text box
I'm writing a GUI that serves to write data to a robot. The robot takes vectors of 11 elements. Once the user puts his vector in the edit text box, I check lenght and correct the vector if necessary. The problem is that when I try to set my edit text to display a vector, the whole box just vanishes. My code is: input = eval(get(hObject,'String')); n=numel(input); if n~=11 if n>11 %avertissement %première ligne de l'avertissement msgboxText{1} = 'Le vecteur est trop long'; %deuxième ligne de l'aver...

MATLAB GUI editable text input strings vs. doubles
Hi. I am working on a GUI that will get a users inputs from a couple of editable text boxes. The user can type in their own values, or load them from a file. Because the numbers will be used in a mathematical way, letters should not be valid inputs. So what I want to know is: how can i make matlab see the difference between numbers and strings. I note that to use the numbers, i must convert the strings in the boxes to numbers after the user inputs them using str2num. But, you see that this would also convert the letter 'a' to a num if the user put 'a' in the editable text...

starting matlab gui outside matlab
Hello! I have to start my matlab gui outside matlab program (without opening it). Is there something like .bat file in Java for Matlab? Thanks for helping me out... :) Emma Hi Emma, I'm not sure if I understand your question. One way would be to compile the GUI (there is a lot of stuff on that in this forum). Otherwise, if you just want to avoid opening Matlab and loading the file, you can use: 1) a simple .bat file with the following command: matlab -minimize -yourfile.m 2) a shortcut with this line as target (but with the full matlab.exe path), in which you also specify your gui dire...

how to convert a Matlab GUI ,matlab independant
i am working on a project in MATLAB and i want to make it MATLAB independant... So that it can run on any PC without MATLAB or in other words i want to make an EXE file for the entire project...please if any one can tell me exact details what to do with the set of files . my project is mainly executed from a GUI which further opens another GUI. the input files are in .dat format (present in same folder) and the result is also stored in the same directory in .dat format. i hav heard about mcc comand but didnt get how to use it for my project.. please reply... ill be greatfull Regards! Ensure...

Access from MATLAB to a non-MATLAB GUIs
Hallo everybody, In one of my MATLAB functions I invoke external EXE file (another program), which makes some calculations. At the end of the calculations a message appears if I want to quit the exernal program (with 'Yes' and 'No' buttons). I want to close this message, because it interrupts the executaion of the whole MATLAB function(a batch file). The message is generated from the exernal program, not from MATLAB, so I can't use a MATLAB handle to close it. So, does anybody knows how I can close those non-MATLAB generated message (GUI) with a command in the MATLAB...

How do I Run a Matlab 6 GUI in Matlab 5
Hi there everyone!! I am designing a Matlab 6 GUI at the university, but have Matlab 5 at home. If I try to run the Matlab 6 Gui,it doesnt want to open. Is there a way to open Matlab 6 GUI's in Matlab 5. Any help will be appreciated Hugo ...

Web resources about - Getting output from MATLAB GUI (edit text) - comp.soft-sys.matlab

Obama bans solitary confinement for juveniles in federal prisons, cites Rikers case as example of the ...
New York Daily News Obama bans solitary confinement for juveniles in federal prisons, cites Rikers case as example of the cruel punishment ...

Flint Water Bills — Government Threatens To Take Kids If Parents Don’t Pay
Flint water bills? Why is there still such a thing? Michigan government seems to lack morals to the fullest extent. It’s threatening to take ...

Makers of Controversial Planned Parenthood Video Face Felony Charges, Seemingly for Fake I.D.s
Makers of the controversial video made to shame Planned Parenthood by pretending to be researchers trying to purchase fetal tissue from the organization, ...

Couple casually takes stunning engagement photos in record-setting blizzard
For one Northeastern couple, buckets full of snow close to their wedding day is not so much a nightmare, but a dream come true Over the stormy ...

Will Twitter Shakeups Make It Relevant Again?
Twitter just fired four top executives and plans to continue its corporate shakeups even more in the coming weeks, but will the changes make ...

Leading Electric Car Models & Leading Companies
In our 4th article pulled from Electric Cars: What Early Adopters & First Followers Want — a new report from CleanTechnica, EV Obsession, and ...

Watch India T20 Cricket Vs. Australia Live Online: Streaming Link, 1st Match Of World Cup Prep Series ...
Fans of the India cricket team will want to watch the first T20 match against Australia streaming live online Tuesday, as their country gets ...

Microsoft Surface Pro Malfunctions, Patriots Lose Place In Super Bowl As A Result
Microsoft might be trying too hard to sell its Surface Pro tablet, which it claims to be the perfect laptop-tablet hybrid in the market right ...

ISIS video shows attackers committing atrocities before Paris siege
PARIS — A new video released by the Islamic State group purports to show the extremists who carried out the Nov. 13 attacks in Paris committing ...

‘Batman V. Superman’: Darkseid Teased, Zack Snyder On Doomsday, And Lois Lane’s ‘Big Scene’ with Batman ...
The hype for the Batman v. Superman: Dawn of Justice movie is gaining. A lot of news has come out regarding the caped crusader and the last son ...

Resources last updated: 1/26/2016 6:58:10 AM