Error using randi Size inputs must be scalar issue.

3 visualizzazioni (ultimi 30 giorni)
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]);

Risposta accettata

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

Accedi per commentare.

Più risposte (1)

KL
KL il 4 Set 2017
randi(1,1,[x_loc1(i)+1,x_loc2(i)-1])
This is not a valid syntax!
  2 Commenti
SHUAB KHAN
SHUAB KHAN il 4 Set 2017
Yeah Thank You I've done it before.
KL
KL il 4 Set 2017
Had you done it before, you would have known that you've used the false syntax in the very first place!

Accedi per commentare.

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by