How to build a matrix from information in multiple matrices

1 回表示 (過去 30 日間)
Ernest Adisi
Ernest Adisi 2018 年 7 月 30 日
コメント済み: KSSV 2018 年 7 月 30 日
I have this file from which I made 2 separate matrices X and y using the 1st and 2nd columns. I now want to create a 3rd matrix from the file. eg find the value from Mat_x(r,c) and Mat_y(r,c) and then scan the txt file to find the resulting value from the row eg. Mat_x(10,10)= 6 Mat_y(10,10)= 6 the the row with x=6 and y=6 give 6.000000 6.000000 0.592404 -6.204762; so Mat_u(10,10) = 0.5924. Can someone show me the way please?

採用された回答

KSSV
KSSV 2018 年 7 月 30 日
A = importdata('B000049.txt') ;
A = A.data ;
x = A(:,1) ; y = A(:,2) ;
u = A(:,3) ; v = A(:,4) ;
xi = unique(x) ; yi = unique(y) ;
[X,Y] = meshgrid(xi,yi) ;
U = reshape(u,size(X)) ;
V = reshape(v,size(X)) ;
  2 件のコメント
Ernest Adisi
Ernest Adisi 2018 年 7 月 30 日
hi, thanks for the response. I understand the top part but can you explain what the code is doing below
KSSV
KSSV 2018 年 7 月 30 日
I am making a grid and reshaping the displacements.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by