How Can I implement the below given matlab code in simulink hdl coder. any Idea please?
Here is my sample code:- [FileName,PathName,FilterIndex] = uigetfile('*.xls'); File = strcat(PathName,FileName); [status,sheets,format] = xlsfinfo(File); testvectordata = xlsread(File,sheets{1,1}); for i = 1:16 weight(1,i) = 0.9999; weight(2,i) = 0.9999; weight(3,i) = 0.9999; weight(4,i) = 0.9999;end for n=1:size(testvectordata,1)-1 input(n,1) = testvectordata(n,1); input(n,2) = testvectordata(n,2); endInput_a = input(:,1);Input_b = input(:,2); Input_a = Input_a';Input_a_c = 1 - Input_a;Input_b = Input_b';Input_b_c = 1 - Input_b; for i = 1:size(Input_a') % Number of samples
%%input sample to the BLOCK
%=====================================================================
in_data = [Input_a(1,i);Input_a_c(1,i);Input_b(1,i);Input_b_c(1,i)]; for j = 1:16 % 16 parallel nodes and each node has 4 weights
match(:,j) = min(in_data,weight(:,j)); MatchVector_Sum = sum(match(:,j)); Weight_Sum = sum(weight(:,j)); if ((MatchVector_Sum/2) >= vigilance ) Test(j) = MatchVector_Sum/(0.1 + Weight_Sum); else Test(j) = 0; end end [TJ,Index] = max(Test); id = Index(1); weight(:,id) = match(:,id); % Update weight
Category = [Category;id]; %==============================================================
end
Best Answer