Clear Filters
Clear Filters

How to remove invalid architectures from the total number of architectures using a function

1 view (last 30 days)
Greetings to all,
I am working on a function, which eliminates the invalid architectures from total number of architectures, using the function, "selectvalidarch". I have written the function and also applied the function into the script, but it is still showing me the total number of architectures.
when I run the code, the total number of architectures is 59049 and when this function used, it is supposed to eliminate the non feasible or invalid archs.
I am attaching the code with the function below:
Code:
total_archs = 59049;
n_arch = total_archs;
n_arch=0;
archs = strings(total_archs,10);
for SP=1:3
SP_opt = arch_deci_options(1,SP);
for LS=1:3
LS_opt = arch_deci_options(2,LS);
for SF=1:3
SF_opt = arch_deci_options(3,SF);
for MF=1:3
MF_opt = arch_deci_options(4,MF);
for AB=1:3
AB_opt = arch_deci_options(5,AB);
for BC=1:3
BC_opt = arch_deci_options(6,BC);
for CD=1:3
CD_opt = arch_deci_options(7,CD);
for PUP=1:3
PUP_opt = arch_deci_options(8,PUP);
for LKG=1:3
LKG_opt = arch_deci_options(9,LKG);
for PAT=1:3
PAT_opt = arch_deci_options(10,PAT);
%Check if the Architecture is valid
stsArchValid = selectvalidarch(SP,LS,SF,MF,AB,BC,CD,PUP,LKG,PAT)
%Update only if the architecture is valid
if stsArchValid
n_arch = n_arch+1;
archs(n_arch,:) = [SP_opt LS_opt SF_opt MF_opt AB_opt BC_opt CD_opt PUP_opt LKG_opt PAT_opt ];
%else
%continue
end
end
end
end
end
end
end
end
end
end
end
n_arch % this number should match total_archs
In the code above, total_archs shows the total number and n_arch, in the last line should give the total valid archs after elimination, using the function.
function: selectvalidarch:
%%
% Function to list invalid functions
function stsArchValid = selectvalidarch(SP,LS,SF,MF,AB,BC,CD,PUP,LKG,PAT)
if SP == 5
if LS == 8
stsArchValid = invalid;
end
end
if LS == 7
if SF == 10
stsArchValid = invalid;
end
end
if SF == 10
if MF == 13
stsArchValid = invalid;
end
end
if MF == 13
if AB == 16
stsArchValid = invalid;
end
end
if MF == 15
if BC == 20
stsArchValid = invalid;
end
end
if MF == 15
if CD == 23
stsArchValid = invalid;
end
end
if AB == 16
if PUP == 27
stsArchValid = invalid;
end
end
if AB == 16
if LKG == 30
stsArchValid = invalid;
end
end
if AB == 16
if PAT == 33
stsArchValid = invalid;
end
end
if exist('stsArchValid','var') == 0
stsArchValid = true;
end
end
It would be really grateful of you if anyone of the experts could help me here find the invalid archs and write it into the script in order to eliminate invalid archs.
Also, I am new to the Matlab, so I kindly request you to consider it too.
Thanking you all in advance.

Answers (0)

Categories

Find more on 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!