Updating a variable(not copying) in gui made in guide
이전 댓글 표시
hi guys,
I made a Gui that is connected to an Access database. the function 'refreshData' is getting updated by a timer every x seconds. Im using handles in the refreshData so the uitable and the listbox can use those variables. Im aware that after refreshData ends the variables are not updated with just using handles en guidata. I have read a lot on the internet but I don't really get it.
The length of variable 'Tijden_chip_1' changes everytime refreshData gets updated. At the end of refreshData I want to update the variable Tijden_chip_1 so the Gui can use the new(bigger) length in the script when refreshData runs again.
(1) the variable Tijden_chip_1 starts empty en gets bigger everytime refreshData runs again. So I have to define Tijden_chip_1 somewhere as an empty cell, otherwise i get the error: variable 'Tijden_chip_1' is not defined. I defined Tijden_chip_1 in the Gui_openingsFcn, but I am not sure that's a good idea.
(2) I have used setappdata(handles.output,'Tijden_chip_1_update',Tijden_chip_1) and guidata(handles.output) to update the variable to the output handles, so I can use getappdata(handles.output,'Tijden_chip_1_update') in the function refreshData. This didn't work.
(3) I used break to detect where it went wrong. If I put the break right before I am using setappdata, Tijden_chip_1 is a 2-by-3 cell array. If I put the break behind setappdata, the workspace says its a 2-by-3 cell array, but if I open the variable its actually a 6-by-3 cell array.
my questions: - Where can if define a variable Tijden_chip_1, which is an empty cell array, that has the same data as Tijden_chip_1 at the end of the script in resfreshData? - Is my approach, updating the data in Tijden_chip_1 to the handles.output, a good idea? Or should i update it to somewhere else? - How is it possible the workspace says: its an 3-by-2 cell array, but if open Tijden_chip_1 it's actually a 6-by-2 array?
I hope someone can help me. Sorry for my bad english.
kind regards,
Rik Wout
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!