MATLAB Datapath アーキテクチャでは、ループの反復でサイズが変化する式はサポートされていません。
이전 댓글 표시
HDL Coderを利用してSimulinkモデルからHDLコードを生成する際、
下記に示すmatlab function block(fcn)を含むモデルを生成実行したところ、以下のエラーが出てしまいます。↓
”式 'output( (i-1)*length(mat(:,1))+1 : (i)*mat(:,1)) )' は、別のループの反復でサイズが変化します。MATLAB Datapath アーキテクチャでは、ループの反復でサイズが変化する式はサポートされていません。”
本エラーを回避するにはどうすればよろしいでしょうか。
宜しくお願いします。
%% matlab function block(fcn)
% mat:大きさ620×5の行列
function output = fcn(input,mat)
output = zeros(length(mat(:,1))*(224+2),1); % output:大きさ140120×1の行列
% 入力inputを4つ毎に区切り、2進数変換行列DataSym(大きさ1×35030の行列)を生成
Digit1 = input(1:4:length(input));
Digit2 = input(2:4:length(input));
Digit3 = input(3:4:length(input));
Digit4 = input(4:4:length(input));
DataSym = 8*Digit1+4*Digit2+2*Digit3+Digit4;
% Datasymの値に応じて行列matの列成分を配列outputに代入
for i = 1:length(DataSym)
switch DataSym(i)
case 0
output( (i-1)*length(mat(:,1))+1 : (i)*length(mat(:,1)) ) = mat(:,1);
case 1
output( (i-1)*length(mat(:,1))+1 : (i)*length(mat(:,1)) ) = mat(:,2);
case 2
output( (i-1)*length(mat(:,1))+1 : (i)*length(mat(:,1)) ) = mat(:,3);
case 3
output( (i-1)*length(mat(:,1))+1 : (i)*length(mat(:,1)) ) = mat(:,4);
case 4
output( (i-1)*length(mat(:,1))+1 : (i)*length(mat(:,1)) ) = mat(:,5);
end
end
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 速度の最適化에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!