次元のサイズ不一致エラー
显示 更早的评论
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]
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 配列と行列の数学 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!