Local Function not being Entered

1 view (last 30 days)
I am trying to create a recursive algorithm, with a local function. But when i test the alg, the initial input variables don't seem to be entering the function. Any suggestions?
V = [4 4 4 4 4]; %vector of ports for a 5 node graph
E = []; %empty edge set
cVf = cumsum(V+1); %cumulative sum of vector plus 1
G = []%empty set of graphs
A = ones(5,5);
function RPM1(V, E, A, cVf, G)
iL = find(V, 1); %find first nonzero entry
L = cVf(iL)-V(iL); %left port
V(iL) = V(iL)-1; %remove the port
Vallow = V .* A(iL,:);
I = find(Vallow); %find non zero entries
for iR = I
R = cVf(iR) - V(iR) %right port
E2 = [E L R]; %combine left, right ports for an edge
V2 = V; %local remaing ports vector
V2(iR) = V2(iR) - 1; %remove port
A2 = A; %local expanded AM
if ~find(V2) %no remaining collections
G{end+1} = E2; %save missorted pm
G = [RPM1(V2,E2,A2,cVf,G)] %recursive

Accepted Answer

Steven Lord
Steven Lord on 19 Nov 2020
You define the local function RPM1 in your script file, but you never call RMP1 inside your script file. MATLAB does not automatically call the local function for you.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!