MATLAB 2008b Compatable alternative.
이전 댓글 표시
I'm using the following function to find the index of an array closest to the value passed. The function doesn't seem to be compatible with v.2008b. I need a function that does the same thing but is compatible. v.2008 is the only version that is compatible with HSPICE.
function[index]=closeindex(value,array)
[~,index]=min(abs(array-value));
end
답변 (1개)
Fangjun Jiang
2011년 8월 29일
The incomparable part is probably the ~ symbol. You can change that line to be:
[trash,index]=min(abs(array-value));
It was introduced in R2009b. http://blogs.mathworks.com/loren/2009/09/11/matlab-release-2009b-best-new-feature-or/
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!