Create .xyz file from grid data
2 ビュー (過去 30 日間)
古いコメントを表示
I have data x(100x1), y(100x1), z(100x100). How can I get data in triplet form (x,y,z)?
0 件のコメント
回答 (1 件)
Pratyush Roy
2021 年 5 月 13 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!