MATLAB Datapath アーキテクチャでは、ループの反復でサイズが変化する式はサポートされていません。
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 速度の最適化 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!