Integer Operands Are Required For Colon Operator When Used As Index ' ?

You have used a noninteger value as one of the parameters (starting value, increment, or stopping value) for the colon (:) operator when using it to create a vector of indices to reference into a function.

You are watching: Integer operands are required for colon operator when used as index

You performed computations to obtain the starting or stopping values for the indexing but the result of those computations was not exactly an integer.
Modify the index computations using the FIX, FLOOR, CEIL, or ROUND functions to ensure that the indices are integers. You can test if a variable contains an integer by comparing the variable to the output of the ROUND function operating on that variable when MATLAB is in debug mode on the line containing the variable.



One supplement is that this is not an error, but it”s really annoying and very time-consuming!!! I tried to recreate this warning in my code, the running time changed from about 150 s to 3000 s! From this perspective, this warning is more badly than an error to an efficient script.

See more: I Climb Every Mountain Swim Every Ocean Lyrics, Calum Scott


Thank you for the answer, this works!!! For me my solution was simply to wrap the math in question with a floor, e.g. –



Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web site

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other country sites are not optimized for visits from your location.

See more: How To Get To 7 7Th Ave. &Amp; 33Rd St., Nyc, 7Th Avenue: Tampa, Florida

Accelerating the pace of engineering and science is the leading developer of mathematical computing software for engineers and scientists.


Leave a comment

Your email address will not be published. Required fields are marked *