how to convert file.m into block in Simulink ?
Show older comments
hi,
I wrote a function that produce 40 binary bits vector according to another 20 bits vector. In Matlab it works ok.
I want to convert it into a blockqmodel in Simulink.
Anybody knows how to do it ?
for example:
function gate_h = gate_array(I_H, indx_h)
no_cells = 20;
if(I_H > 0)
TMP_reg = [zeros(1, no_cells-indx_h), ones(1, indx_h)];
else
TMP_reg = [ones(1, indx_h), zeros(1, no_cells-indx_h)];
end
bitpatterns = {[0 1], [1 0]};
gate_h = cell2mat(bitpatterns(TMP_reg + 1));
Thanks, Henry
Accepted Answer
More Answers (1)
Rick Rosson
on 4 Mar 2016
0 votes
Have you tried using the MATLAB Function block? It's in the User Defined Functions sub-library in base Simulink.
Categories
Find more on String 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!