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.
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!
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 brianowens.tv country sites are not optimized for visits from your location.
Accelerating the pace of engineering and science
brianowens.tv is the leading developer of mathematical computing software for engineers and scientists.