MATLAB: Error:Subscript indices must either be real positive integers or logicals.

error

Hi,
I get this error ,
Subscript indices must either be real positive integers or logicals. The line with this error is,
simout_diff=(simout_ps(t_plot,:,1))-(full_vehicle_data_cw(t_plot,:,1));
Please help me in resolving this error and what is meant by subscript indices?

Best Answer

Matlab is telling you that 't_plot' is neither an integer greater than zero nor a logical variable. Since it is interpreted as an index to both the 'simout_ps' and 'full_vehicle_data_cw' arrays, this violates one of matlab's rules. In case you meant these to be functions rather than arrays, then for some reason matlab is not recognizing them as such.