Subscript indices must either be real positive integers or logicals.

2 views (last 30 days)
Hello everybody! I am making a program in order to plot the velocity profile (of a fluid), with respect to its maximum shear stress, so I want to plot the velocity (U) in the columns where it's reached that maximum, the code is the following:
position=max(TAU); plot(r,U(position,:),'b')
where TAU and U are both matrices with dimensions equal to = 12045x50 and r is a dimensionless number which has dimension=50x1
and I obtained the following error: Subscript indices must either be real positive integers or logicals.
Which should I do?
Thanks.

Answers (1)

Youssef  Khmou
Youssef Khmou on 13 May 2013
hi Isabel
You obtained that error because the variable position corresponds to the Numberical maximums not the Index or 'position' as you mean , try this :
[Values,Position]=max(TAU);
plot(r,U(position,:),'b')

Categories

Find more on Stress and Strain in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!