次元のサイズ不一致エラー
Mostra commenti meno recenti
R2019bのSimulinkにて、正規分布で配列を生成し、ヒストグラムを作成して各Binの左edgeを1行目、Binのカウント数を2行目とするMATLAB Functionを作成したのですが、下記の通りエラーメッセージが表示されてしまいます。
- 次元のサイズ不一致エラー 2:1 が必要ですが実際のサイズは 16 です。 Error in 'BatReuseBusiness/NormalDistribution/MATLAB Function' (line 8) Array = [edges(1:end-1);N];
作成したコードは下記の通りです。
function Array = fcn(Quantity,mu,sigma,BinWid)
rng('shuffle')
pd = normrnd(mu,sigma,[1,Quantity])
[N,edges] = histcounts(pd,'BinWidth',BinWid)
Array = [edges(1:end-1);N];
テスト段階で同様のコード下記の通り.mファイル作成、実行した際は問題なく動作していたため、Simulinkにおける設定の問題かと考えているのですが、どなたか対処法をご教示頂けませんでしょうか。
Quantity = 10000
rng('shuffle')
pd = normrnd(10000,1000,[1,Quantity])
histogram(pd,'BinWidth',500)
[N,edges] = histcounts(pd,'BinWidth',500)
Array = [edges(1:end-1);N]
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su 配列と行列の数学 in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!