MATLAB: Why am I getting this error, Subscript indices must either be real positive integers or logicals, when trying to set axis limits axislogicalssubscript indices I am plotting two volltage against time, I try to set the axis as follows, axis([-0.1, 0.1 40 140]) but get this error; Subscript indices must either be real positive integers or logicals. Best Answer In the Command Window, type:whos axisI suspect you have a variable named ‘axis’ that is causing the error. The solution: rename the variable. Related SolutionsMATLAB: Subscript indices must either be real positive integers or logicals error, Try thisclear sinr=10;z=0:0.1:4*pi;x=r*(z-sin(z))Probably sin was used as a variable in a previous program MATLAB: Problem trying to remove numbers from plot axes Did you define a variable called "set"? Check this by adding this before the failing command:which set -allShadowing built-in functions in Matlab is a bad idea and leads to such bugs frequently. Related QuestionError of Subscript indices must either be real positive integers or logicals, index exceeds matrix dimension,Subscript indices error, excel, textscan.
Best Answer