- uint8
- fixdt(0,23,0)
- fixdt(1,16,0)
Simulink上のバスオブジェクトのバイトサイズを確認する方法を教えてください
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
バスオブジェクトの各要素のサイズを数え上げる以外に、 Simulink上のバスオブジェクトのバイトサイズを確認する方法があれば教えてください。
1 commentaire
Kei Otsuka
le 29 Sep 2017
バスオブジェクトの各要素のデータ型からBit数を求め、それらの総和を取る形になると思いますが、その方法では何か問題がありますでしょうか?
数える作業を自動化したい、ということでしたら方法はあると思います。
例えば、myBusという名前のバスオブジェクトがあり、3つの要素を持つとします。 3要素のデータ型がそれぞれ
であった場合、以下のスクリプトを実行することでトータルのバス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
Réponses (0)
Voir également
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!