필터 지우기
필터 지우기

std function error "Subscript indices must either be real positive integers or logicals."

조회 수: 1 (최근 30일)
Pardon my stupidity but I really dont understand why matlab refuses to compute the standard deviation.
I checked the data: 355 X 1 double (no NaN inside or whatever). I can compute the mean, sum, median, of this exact same data but I receive an error when I want to do the std ...
I tried the following: A=[1 2 3 1 2 3]';
B=std(A) New error: Index exceeds matrix dimensions.
But if I do it on a brand new script, it works !!
Can anyone tell my what the hell is happening there ?
Thank you so much in advance !

답변 (1개)

Chandani Madnani
Chandani Madnani 2018년 2월 26일
편집: Chandani Madnani 2018년 2월 26일
I tried to reproduce the scenario by executing the below commands:
>> A=[1 2 3 1 2 3]';
>> B=std(A)
But I get a response:
B =
0.8944
Which version of MATLAB are you using and on which platform ? Is A initialized to something else in between the two commands ?
  댓글 수: 1
Pierre Lonfat
Pierre Lonfat 2018년 2월 27일
I actually found the answer and it is really stupid unfortunately. Never name a variable std (which is used to call the function for the standard deviation). Then everything is right again! Thank you for your answer !

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by