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

3 Ansichten (letzte 30 Tage)
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

Antworten (1)

TastyPastry
TastyPastry am 19 Okt. 2015
myVals = diag(z(X,Y));

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by