Construct an array from the position of a certain value in a matrix

조회 수: 3 (최근 30일)
Richard Wood
Richard Wood 2020년 10월 24일
댓글: Stephen23 2020년 10월 25일
Hello everyone
Let's assume we have a matrix, which I attach, matrix.dat, which has 220x200 elements (https://we.tl/t-KwSPQEsCtf link to download the aformentioned matrix). This matrix would correspond to the definition of two physical quantities, given by
time=horzcat(linspace(0,20,200),linspace(21.1,40,20));
field=linspace(0,50,200);
What I am looking for is that, when there is, for a time element, a value in the matrix that is equal to 1.5708, the value of the first field element is stored in a new array. As you can see, for the first elements of time, there is no matrix value that matches the aforementioned value of 1.5708. So I don't know beforehand what the dimension of my vector will be, ?x1 elements. Is there an efficient way to build the above array?
  댓글 수: 1
Stephen23
Stephen23 2020년 10월 25일
This seems like something that might be solves using interpolation or perhaps one of the contour functions. Can you please show us the first few terms of the expected output vector.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by