• 12
• 12
• 9
• 10
• 13

# (Matlab) handles not updating

This topic is 1758 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi

I have a gui and i run this function to get some data and store it in handles.

function
updateButton2_Callback(hObject, eventdata, handles)

[handles.allPark,count,handles.allParkData]=allPark();
d=handles.allPark;

str=sprintf('(based on prodData)\n\nTurbines: %.0f \nLosses: %.1f %% \nPeriod: %.1f yrs\n\nTotal losses: %.1f GWh\nTotal prod: %.1f GWh',count,d(1),d(4),d(2),(3));
set(handles.resultsPark,'String',str);
guidata(hObject, handles);

I use it in another callback and the data is there and works. But sometimes (not always) when i run another loadFunction (depending on the data) those data (handles.allPark for example) is set to zero.

How can it be set to zero? The only time i set handles.allPark=0 is in the openingFcn and it is not run other then at startup (i have checked).

Is this connected to that i sometimes have to run: (got this tip from the net and it solved another handles-related problem)

handles = guidata(hObject);

Altough i dont understund why such an updata is needed...

Im very confused. Thanks for any help

Erik

Edited by suliman