Error: Undefined function or variable 'xxx'.
4 views (last 30 days)
Show older comments
Hi Guys, im working on a function to ged the Variance of a dataset. No matter, if i rund the function in the command window, if i want to run it in a script i get the following error:
Undefined function or variable 'NeuroCombMi'.
Error in getNeuroKombMi (line 135)
disp(NeuroCombMi);
It ist working for the mode 'normal, bute the error comes if i run it with the mode 'transp'.
Code below:
% get best Neuronenkombination via Mittelwert
% 20 Neuronenkombinationen
function NeuroCombVar = getNeuroKombVar(safe, neurons, mode, No)
%% SECTION TITLE
% DESCRIPTIVE TEXTmode:
if nargin < 3
mode = 'normal';
No = 5;
end
nr = length(neurons);
Neuros = zeros(1, nr);
lenght = size(safe);
counter = 1;
%% Varianz
% First, Fill Matrix with all Datas sorted for Neuronenkombination
for i=0:nr:(lenght(2)-1)
for j=1:1:nr
Neuros(counter, j) = safe(j+i);
% disp(count);
% count = count+1;
end
counter = counter+1;
end
%% Calculate Varianz
% DESCRIPTIVE TEXT
if (strcmp(mode,'normal'))== 1
NeurosAns = zeros(1, nr);
for k=1:1:nr
NeurosAns(1, k) = var(Neuros(:, k)); %Median
end
elseif (strcmp(mode,'transp'))== 1
NeurosAns = zeros(1, (lenght(2)/nr));
for m=1:(lenght(2)/nr)
NeurosAns(1, m) = var(Neuros(m,:));
end
end
%% SECTION TITLE
% DESCRIPTIVE TEXT
if (strcmp(mode,'normal'))== 1
t = mink(NeurosAns, No); %5
x = zeros(No,1);
index = zeros(No,1);
teiler = zeros(No, 1);
for v=1:1:No
x(v) = find(NeurosAns == t(v));
index(v) = mod(x(v), nr);
teiler(v) = floor(x(v)/nr)+1;
if index(v) == 0
teiler(v) = teiler(v)-1;
end
neurost(1 , v) = neurons{x(v), 1}(1, 1);
neurost(2 , v) = neurons{x(v), 1}(1, 2);
if v == No
neurostT = neurost';
tt = t';
NeuroCombMedtemp = [ tt(:), neurostT(:, 1), neurostT(:, 2) ];
NeuroCombVar=array2table(NeuroCombMedtemp,...
'VariableNames', {'Varianz','HiddenLayer1', 'HiddenLayer2'});
end
end
elseif (strcmp(mode,'transp')) == 1
if No > (lenght(2)/nr)
No = (lenght(2)/nr);
end
t = mink(NeurosAns, No);
for v=1:No
x(v) = find(NeurosAns == t(v));
end
if v == No
xt = x';
tt = t';
NeuroCombMedtemp = [ tt(:), xt(:) ];
NeuroCombVar=array2table(NeuroCombMedtemp,...
'VariableNames', {'Varianz','TableNo'});
end
end
disp(NeuroCombVar);
end
hope you guys can help me. ThankS!!
0 Comments
Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!