I have data x(100x1), y(100x1), z(100x100). How can I get data in triplet form (x,y,z)?

답변 (1개)

Pratyush Roy
Pratyush Roy 2021년 5월 13일

0 개 추천

Hi Laxmikant,
You can use the meshgrid to create 2D grids in the X-Y plane and the concat function to concatenate the grid with the Z values. The code snippet below might be helpful to get the data in triplet form:
[X,Y] = meshgrid(x,y);
data = concat(3,X,Y,z); % Here 3 refers to 3rd dimension along which we are concatenating the arrays
triplet_11 = data(1,1,:); % Triplet value at index (1,1) . To obtain triplet at position (i,j) we can use data(i,j,:)
Hope this helps!

댓글 수: 1

Jacob Valdes
Jacob Valdes 2021년 6월 18일
Undefined function 'concat' for input arguments of type 'double'.

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

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2021년 4월 28일

댓글:

2021년 6월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by