次元のサイズ不一致エラー
이전 댓글 표시
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!