Return the value from a specific excel colomn/row

1 visualización (últimos 30 días)
Grace Carey
Grace Carey el 20 de Abr. de 2021
Respondida: David Hill el 20 de Abr. de 2021
I'm trying to return the value from a specific cell from an excel spreadsheet. The user enters a latitude value and then a longitude value, and then the ambient temperature of those coords is returned. The latitude and longitude are in seperate columns. How do I find the row where both the latitude and longitude match the user's input, and then use that row number to return the temperature?

Respuestas (1)

David Hill
David Hill el 20 de Abr. de 2021
If you don't provide an example, we don't know what the format of lat/long/temp is in. They might be numbers or strings.
a=readmatrix('yourMatrix.xlsx');
lat=input('input latitude: ');%assuming lat is only a number not a string
long=input('input longitude: ');%assuming long is only a number not a string
temp=a(ismember(a(:,1:2),[lat,long],'rows'),3);

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by