필터 지우기
필터 지우기

How to find the position index of vector array

조회 수: 1 (최근 30일)
University
University 2023년 11월 8일
댓글: University 2023년 11월 8일
Hi,
I have meshgrid on X1 and and Y1 but I have attached only the X1 and x1 and y1 files
l=6.6667e-6, l is a line that divides the X1 grid into 2 equal part.
I have been able to plot this using the code below, which exactly what I wanted.
A = (X! >= -l/2 & X <= l/2);
imagesc(x, y, A)
Please, how can find position of -l/2 and l/2 ?
  댓글 수: 3
University
University 2023년 11월 8일
Hi Matt,
Using the data I have attached. I have been able to plot the data below:
A = (X1 >= -l/2 & X1 <= l/2);
imagesc(x, y, A)
hold on
plot([-l/2 l/2],[-1e-6 -1e-6],'r-', LineWidth=2)
xlabel('x')
ylabel('y')
In the attached plot. I have red line at the top of the figure. My question is how can I find index poistion of the starting and the ending point of the line. I.e., index position of -l/2 and l/2, l=6.6667e-6.
Matt J
Matt J 2023년 11월 8일
openfig fig
ans =
Figure (1) with properties: Number: 1 Name: '' Color: [1 1 1] Position: [360 97.6667 560 420] Units: 'pixels' Use GET to show all properties

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

채택된 답변

Matt J
Matt J 2023년 11월 8일
start=find(A(1,:),1,'first');
stop=find(A(1,:),1,'last');
  댓글 수: 1
University
University 2023년 11월 8일
Great, thank you Matt. You have been so helpful.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by