Error using randi Size inputs must be scalar issue.

1 次查看(过去 30 天)
I was using matlab 2015a version and instead of using Randi, i used Randint, but in 2017 version its not accepted and if i'm using randi then its showing eror Error using randi Size inputs must be scalar. Error in hetro_net (line 73) Xloc(s)=randi(1,1,[x_loc1(i)+1,x_loc2(i)-1]); how it can solved? Showing Error using randi Size inputs must be scalar. Error in hetro_net (line 73) Xloc(s)=randi(1,1,[x_loc1(i)+1,x_loc2(i)-1]);

采纳的回答

Andrei Bobrov
Andrei Bobrov 2017-9-4
randi([x_loc1(i)+1,x_loc2(i)-1],1,1)
or just
randi([x_loc1(i)+1,x_loc2(i)-1])
  1 个评论
SHUAB KHAN
SHUAB KHAN 2017-9-5
编辑:SHUAB KHAN 2017-9-5
Actually syntax orientation has been changed but in previous version it was different and Thank you Andrei, I've already done this. :)

请先登录,再进行评论。

更多回答(1 个)

KL
KL 2017-9-4
randi(1,1,[x_loc1(i)+1,x_loc2(i)-1])
This is not a valid syntax!
  2 个评论
KL
KL 2017-9-4
Had you done it before, you would have known that you've used the false syntax in the very first place!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 NaNs 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by