Subscript indices must either be real positive integers or logicals.

조회 수: 1 (최근 30일)
Isabel
Isabel 2013년 5월 13일
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.

답변 (1개)

Youssef  Khmou
Youssef Khmou 2013년 5월 13일
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')

카테고리

Help CenterFile Exchange에서 Stress and Strain에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by