setappdata storing variable with 'Settings' type

2 views (last 30 days)
Hi all,
Here is my code:
function reInit()
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
load('reInitSettings.mat') %contains UD and Settings variables
hMainGui = getappdata(0, 'hMainGui'); %handle for the main figure
setappdata(hMainGui, 'Settings', Settings)
setappdata(hMainGui, 'UserData', UD)
hMainGui=getappdata(hMainGui, 'Settings')
save('test.mat', 'hMainGui', 'Settings')
%%don't worry about anything below this comment
button=findobj('Tag','btConnect');
trigger=get(button,'Callback');
trigger(button,guidata(hMainGui));
When I open 'test.mat', I get the 'Settings' variable which is a 1x1 struct as I expected, and I get the 'hMainGui' variable which is actually a 1x1 Settings (whatever that is). So for some reason setappdata is storing the variable with this unusual format, which doesn't work.
Does anyone have any insight into what is going on here?
Thanks John

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!