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

3 vues (au cours des 30 derniers jours)
Peter Dorofy
Peter Dorofy le 19 Oct 2015
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

Réponses (1)

TastyPastry
TastyPastry le 19 Oct 2015
myVals = diag(z(X,Y));

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by