Getting 'Reference to non-existent field' Error
Afficher commentaires plus anciens
I have this code I run and i cant set my button properties using the callback at the end of the script. I tried it with an another code with the same parent buttons/figures relation and it did work. Now I want to understand what is wrong with those lines and I dont seem to find it. Teach me please! It keeps on telling me Reference to non-existent field...
Thanks in advance
function [] = HandlingGUIReal()
%%BACKGROUND FIGURE
Handling.Background = figure('units','pixels',...
'position',[200 75 800 600],...
'menubar','none',...
'name','Problem Example');
Handling.ClosePB = uicontrol('style','pushbutton',...
'units','pixels',...
'Parent',Handling.Background,...
'position',[550 15 70 22],...
'string','Close',...
'callback',{@ClosePB_callback,Handling});
%%DATA PANEL
Handling.DataPanel = uipanel('units','pixels',...
'position', [50 450 250 50],...
'Title','Data',...
'Parent',Handling.Background);
Handling.LoadDataPB = uicontrol('style','pushbutton',...
'units','pixels',...
'Parent',Handling.DataPanel,...
'position',[31 12 69 22],...
'string','Load Data',...
'callback',{@LoadDataPB_callback,Handling});
%%TEMPLATE PANEL
Handling.TemplatePanel = uipanel('units','pixels',...
'position', [50 350 250 100],...
'Title','Template',...
'parent',Handling.Background);
Handling.LoadTemplatePB = uicontrol('style','pushbutton',...
'units','pixels',...
'Parent',Handling.TemplatePanel,...
'position',[27 15 85 23],...
'string','Load Template',...
'Enable', 'off');
Handling.CreateTemplatePB = uicontrol('style','pushbutton',...
'units','pixels',...
'Parent',Handling.TemplatePanel,...
'position',[130 15 90 23],...
'string','Create Template',...
'Enable', 'off');
Handling.TemplatePUM = uicontrol('style','popupmenu',...
'units','pixels',...
'Parent',Handling.TemplatePanel,...
'string',' ',...
'position',[30 50 95 22],...
'Enable', 'off');
function LoadDataPB_callback(varargin)
% Callback for pushbutton.
Handling = varargin{3}; % Get the structure.
Handling.DataRunFigure = figure('units','pixels',...
'position',[120 120 750 400],...
'name','Data Run Definition Tool');
Handling.OkPB = uicontrol('style','pushbutton',...
'units','pixels',...
'Parent',Handling.DataRunFigure,...
'position',[110 25 80 22],...
'string','OK',...
'callback',{@OKDataPB_callback,Handling});
function OKDataPB_callback(varargin)
% Callback for pushbutton.
Handling = varargin{3}; % Get the structure.
set(Handling.LoadTemplatePB,'Enable','on')
set(Handling.CreateTemplatePB,'Enable','on')
set(Handling.TemplatePUM,'Enable','on')
close(Handling.DataRunFigure)
Réponse acceptée
Plus de réponses (1)
amir aslam
le 17 Juin 2019
0 votes
Teach me please! It keeps on telling me Reference to non-existent field...
clear; close all; clc;
addpath('lib')
testData = load('data.mat');
nnOptions = {};
modelNN = learnNN(testData.X, testData.y, nnOptions);
plotConfMat(modelNN.confusion_valid);
%% Predicting on Malware
rI = randi(size(testData.X, 1));
p = predictNN(testData.X(rI,:), modelNN);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
input_layer_size = size(X, 2);
layers = [input_layer_size, hiddenLayers, nrOfLabels];
modelNN.activationFn = activationFn;
modelNN.lambda = lambda;
modelNN.maxIter = maxIter;
modelNN.layers = layers;
modelNN.doNormalize = doNormalize;
X(isnan(X))=0;
Y = Y - min(Y) + 1;
m = size(X, 1);
validation_set_size = round(m*validPercent/100); % e.g. 10% for the validation
rand_indices = randperm(m);
X = X(rand_indices, :);
Y = Y(rand_indices);
X_valid = X(1:validation_set_size, :);
Y_valid = Y(1:validation_set_size);
X(1:validation_set_size,:) = [];
Y(1:validation_set_size) = [];
modelNN.X = X;
modelNN.Y = Y;
modelNN.X_valid = X_valid;
modelNN.Y_valid = Y_valid;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Catégories
En savoir plus sur Interactive Control and Callbacks dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!