Use Excel columns as X Y cell coordinates to look up Z values from matrix

조회 수: 1 (최근 30일)
Peter Dorofy
Peter Dorofy 2015년 10월 19일
답변: TastyPastry 2015년 10월 19일
Hello,
I have imported an excel spreadsheet where column A are X coordinates and column B are Y coordinates
example:
Column A: 2,4,6,8, ... X
Column B: 1,3,4,7, ... Y
I have a large 2000x1000 matrix where each cell has some Z value. I need to be able to extract the Z values from the matrix using the X Y coordinates imported from Excel. Ultimately I will be exporting a third column C which contains those Z values back to excel. Below is what I have, but not sure where to go from here:
X = xlsread('data.xlsx','A1:A100');
Y = xlsread('data.xlsx','B1:B100');
I need to lookup and store the Z values of those 100 data points from the 2000x1000 matrix. It sounds like it should be simple, but somehow I am missing something. Any suggestions?
Thanks,
-Peter

답변 (1개)

TastyPastry
TastyPastry 2015년 10월 19일
myVals = diag(z(X,Y));

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by