I can not modify data in a table

Good afternoon. My problem is as follows. I have 2 guide, one depends on another. What happens is that the guide number 1 has certain data that I need to transfer for the creation of the guide 2, in which there will be a table (of 2 columns) that should be created automatically with the data of the guide one and that will have "n" number of rows I already managed to get the table in guide 2 to be created as I need it, however I can not get the data that I enter (by keyboard) to keep on the table. I leave the cogigos if someone can tell me what is happening:
Thank you very much and I am attentive to your answers.
for the guide 1:
handles.data_form2_will_need = KC;
guidata(hObject,handles);
form2_h = form2();
%-------------------
for the guide 2:
function CalcularDin_Callback(hObject, eventdata, handles)
% hObject handle to CalcularDin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
syms w
global NP
for k=1:NP
Mat_masa = get(handles.TablaMasa,'Data');
end
function form2_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 form2 (see VARARGIN)
% Choose default command line output for form2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
%-------------------------------------------------------
global NP
handles.form1_h = findobj(groot, 'tag', 'form1');
handles1 = guidata(handles.form1_h); %this is form1's handles
handles.data_form2_needs = handles1.data_form2_will_need;
guidata(hObject, handles)
TTT=handles.data_form2_needs;
guidata(hObject, handles)
NumPiso= length ( TTT ( : , 1 ) ) - 1 ;
num_elem=cell(NumPiso,2);
num_elem(:,:)={''};
set(handles.TablaMasa,'Data',num_elem);
NP=NumPiso;
for k=1:2 %-length(NP) %-
NND(k,1) = NumPiso;
NumPiso=NumPiso-1;
set(handles.TablaMasa,'Data', NND);
end%-

5 comentarios

Geoff Hayes
Geoff Hayes el 3 de Jun. de 2019
Pedro - please clarify what you mean by however I can not get the data that I enter (by keyboard) to keep on the table. Are both GUIs open (at this point) and are you entering something in the first GUI? Or in the second? Please include all of your steps and any error messages that you are observing.
Pedro Guevara
Pedro Guevara el 3 de Jun. de 2019
Thank you very much for your prompt response. Indeed, by the time the guide is opened, guide 1 is still open. What I mean by "I can not get the data I enter", is that when the table in guide 2 is created automatically (with the "n" rows) I can not keep the data that I write by keyboard on column 2 of that table, that is to say that if I pass from one cell to another, the digit is erased
Geoff Hayes
Geoff Hayes el 3 de Jun. de 2019
You may need to show more of your code especially that for the table.
Pedro Guevara
Pedro Guevara el 3 de Jun. de 2019
I do not have more code in the Guide 2. It's everything I have programmed.
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey el 10 de Oct. de 2019
I would suggest using uitable and storing it in a handle. You can save or export the handle from one gui to the next. Then it's just a matter of transferring the data. I found using uitable very useful when updating a plot in real time.

Iniciar sesión para comentar.

Respuestas (1)

CAM
CAM el 10 de Oct. de 2019

0 votos

Have you considered using appdata instead of guidata?
In this matlab answer (Appdata answer with link), there is a link to a great video by Doug Hull (former Mathworks employee) that addresses your situation directly and shows how to use appdata.

Categorías

Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.

Productos

Versión

R2017b

Preguntada:

el 3 de Jun. de 2019

Respondida:

CAM
el 10 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by