Matlab - Duda- Tomar los valores de una tabla y graficar en GUI

 
Vista:
sin imagen de perfil

Duda- Tomar los valores de una tabla y graficar en GUI

Publicado por Ivonne (1 intervención) el 11/07/2014 19:16:23
Hola a todos!

Soy nueva tanto en el foro como usando la interfaz gráfica de matlab, espero puedan ayudarme! :)

Estoy haciendo en GUI de matlab un programa muy largo, pero estoy atorada en la primera parte, que se trata de ingresar por el usuario datos a una tabla y posteriormente tomar estos datos para realizar mas operaciones, entre ellas graficar.

Ya logré hacer que el usuario coloque el número de filas y se adapte la tabla, y la pueda editar, sin embargo al querer guardar los datos utilizando la siguiente sentencia

Datos=get(handles.TablaHieto,'data');

Me muestra el siguiente error ??? Undefined function or variable 'handles'.

No entiendo porque :/ !, ojalá puedan ayudarme.

Les muestro mi código a continuación

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

% Last Modified by GUIDE v2.5 11-Jul-2014 11:42:10

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

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

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Hidrograma_Transito wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Hidrograma_Transito_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 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)

% El usuario escribe la cantidad de filas de la matriz
fil=str2double(get(handles.filas,'String'));
col=2;
size_table=cell(fil,col);
size_table(:,col)={''};
set(handles.TablaHieto,'Data',size_table)
set(handles.TablaHieto,'ColumnEditable',true(1,col))


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


% --- Executes during object creation, after setting all properties.
function filas_CreateFcn(hObject, eventdata, handles)
% hObject handle to filas (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 on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Datos=get(handles.TablaHieto,'Data');


Muchas gracias de antemano!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder