Effacer les filtres
Effacer les filtres

Simulink上の​バスオブジェクトのバ​イトサイズを確認する​方法を教えてください

2 vues (au cours des 30 derniers jours)
tnksral
tnksral le 29 Sep 2017
Commenté : Kei Otsuka le 29 Sep 2017
バスオブジェクトの各要素のサイズを数え上げる以外に、 Simulink上のバスオブジェクトのバイトサイズを確認する方法があれば教えてください。
  1 commentaire
Kei Otsuka
Kei Otsuka le 29 Sep 2017
バスオブジェクトの各要素のデータ型からBit数を求め、それらの総和を取る形になると思いますが、その方法では何か問題がありますでしょうか?
数える作業を自動化したい、ということでしたら方法はあると思います。
例えば、myBusという名前のバスオブジェクトがあり、3つの要素を持つとします。 3要素のデータ型がそれぞれ
  1. uint8
  2. fixdt(0,23,0)
  3. fixdt(1,16,0)
であった場合、以下のスクリプトを実行することでトータルのバスBit幅が算出できます。
bitw = 0;
for i = 1:size(myBus.Elements, 1)
type = myBus.Elements(i).DataType;
a = strsplit(type,',')
if size(a, 2) == 1 %fixdtではない場合
b = regexp(a,'\d*','Match');
for ii= 1:length(b)
num(ii,1)=str2double(b{ii}(end));
end
bitw = bitw + num;
else
bitw = bitw + str2num(a{2});
end
end

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur マルチコア プロセッサ ターゲット dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!