Subscript indices must either be real positive integers or logicals.

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Youssef  Khmou
Youssef Khmou il 13 Mag 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')

Categorie

Scopri di più su Stress and Strain in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by