Hi everyone,
I've got a somewhat strange error in one of my GUI-functions. After creating the global Struct "Data" in which I want to save my Variables, I don't have any Variables to access… I don't know the Matlab error, because I'm working with Octave at home, so I can only show you the Octave error:
C:/**/BHKW Berechnungerror: structure has no member 'Geb' error: called from BHKW_GUI at line 94 column 1
A short snippet of my code is:
function BHKW_GUI%BHKW_GUI ...
% Global Vars:
global Data BHKW_GUIH% Add path:
Path = mfilename('fullpath');[Path,~,~] = fileparts(Path);addpath(genpath(Path));fprintf('test %s',Path)%%Default-Values:
Data.Geb.Heizlast = 40;Data.Geb.Wfl = 3000;Data.Geb.HG = 12;Data.Geb.MinTA = -16;% Standard-TRY (2010, normales Jahr, Mnchen, mittlerers Stadtgebiet)
Data = load(fullfile(Path,'TRY','TRY2010_norm_MUC_mittlStadtgebiet.mat'));%%Start GUI:
set(0,'defaultuicontrolunits','centimeters');set(0,'defaultaxesunits','centimeters');set(0,'defaulttextinterpreter','latex');% make figure:
BHKW_GUIH.Fenster = figure('Name','BHKW Auslegung');% set(GUIH.Fenster,'Units','centimeters','Position',[1.5 2 45 24]);
set(BHKW_GUIH.Fenster,'Units','normalized','Position',[0.01 0.05 0.98 0.87]);% make axes:
BHKW_GUIH.Axes = axes('Position',[28 14 20 10]);% texts and edits (only one to show what I did here):
BHKW_GUIH.TextHL = uicontrol('Style','text','String','Norm-Heizlast [W/m^2]:',... 'Position',[1 23 3.5 1]);BHKW_GUIH.EditHL = uicontrol('Style','Edit','String','40',... 'Position',[4.5 23.5 1 0.6],'Callback',@EditHL);end%%Callbacks
function EditHL(HObject,Event) TMP = get(HObject,'String'); Data.Geb.Heizlast = str2double(TMP); JDL();end
Any advice how to solve this error? I've always been working with structs to pass my variables and I've never encountered this error before. Maybe a typo I can't find? At work I'm using Matlab, so the error is not related to Octave… Thanks in advance!
Best Answer