Error using randi Size inputs must be scalar issue.

조회 수: 3 (최근 30일)
SHUAB KHAN
SHUAB KHAN 2017년 9월 4일
편집: SHUAB KHAN 2017년 9월 5일
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
SHUAB KHAN
SHUAB KHAN 2017년 9월 4일
Yeah Thank You I've done it before.
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에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by