How to write register/array into Simulink simple port RAM ?

1 次查看(过去 30 天)
Hi,
I have a block, inside it there is a Register. That Register is also an output from that block.
I want to write Register into a simple ram, outside that block. when I do so, too meny errors appear.
A part from that block:
function [gate_h,reg_out] = gate_cntrl_h(INDX,I1,V,reg_old)
n = 8;
gate_h = zeros(1,n);
reg_out = zeros(1,n/2);
switch INDX
case 0
reg_out(:) = 0;
case 1
if(min(V) > VC_limit)
[C,I] = min(V);
reg_out(I) = 1;
else
for j=1:length(reg_out)
if(reg_out(j)==reg_old(j))
reg_out(j)=reg_old(j);
else
[C,I] = min(V);
reg_out(I) = 1;
end
end
end
...
...
How can I write reg_out into an outside simple RAM ?
when I do so, too meny errors...
for example..
Error in port widths or dimensions. Output port 1 of 'gate_cntrl/Single Port RAM/din' is a [1x4] matrix.
Component: Simulink | Category: Block error
Error in port widths or dimensions. Input port 2 of 'gate_cntrl/Single Port RAM/wr_port' is a one dimensional vector with 1 elements.
Component: Simulink | Category: Block error
Can someone help me to solve it ?
Thanks, Henry

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by