Unknown Error Message from using interp1
조회 수: 1 (최근 30일)
이전 댓글 표시
Using this table how do I resolve the error message below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/396949/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/396954/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/396959/image.jpeg)
댓글 수: 0
답변 (1개)
Walter Roberson
2020년 10월 30일
if year < 1990 | year > 2018 | mod(year,2) == 1
disp("This is not an even year from 1990 to 2018");
else
male_vote = interp1(YourTable.Year, YourTable.Male, year);
female_vote = interp1(YourTable.Year, YourTable.Female, year);
go = 0;
end
But I would suggest
if year < 1990 | year > 2018 | mod(year,2) == 1
disp("This is not an even year from 1990 to 2018");
else
mask = YourTable.Year == year;
male_vote = YourTable(mask).Male;
female_vote = YourTable(mask).Female;
go = 0;
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!