how to write a code to extract a positive latitude value for the corresponding positive longitudinal cell value

suppose we have longitudinal =[-50;-60;-70;-80;-90;-100;-50.5;-60.5;-70.5;-80.5;-90.5;-100.5;50;60;70;80;90;100;50;60;70;80;90;-100.5]
and latitude =[-5;-10;-20;-30;-40;50;-1.5;-10.5;-20.5;-30.5;-40.5;50.5;0;10;20;30;40;50;0.5;10.5;20.5;30.5;40.5;50.5] data point like this then for the longitudinal range(i.e 50 to 100) we should get the postive latitude range(i.e 0 to 40)
for example :the longitudinal value 90 have the corresponding latitudinal value 40 and similarly longitude value 100 have latitude 50.
plz help in getting the code and the range should be for longitudinal(50 to 100) latitude (0 to 40) ,within this range only i have to get data points

Risposte (1)

% filter
idx = longitudinal >= 50 & longitudinal <= 100 & latitude >= 0 & latitude <= 40;
% selection
longitudinal2 = longitudinal(idx);
latitude2 = latitude(idx);

4 Commenti

lat long
-5 -50
-10 -60
20 -70
-30 -80
40 -90
50 -100
-1.5 -50.5
-20.5 -70.5
-30.5 -80.5
-40.5 -90.5
50.5 -100.5
0 50
10 60
-20 70
30 80
40 90
50 100
0.5 50.5
10.5 60.5
20.50 70.5
-30.5 80.5
40.5 90.5
50.5 -100.5
thank you fabio for answering my question but my aim is not to get the positive latitude and longitude of the given range,i need to get a latitude value for the corresponding longitude value within the given range,for example the 90 is the longitude which holds the corresponding latitude value and both the value of latitude and longitude lies in the given range given before,consider this latitude and longitude as the column 1 and colum 2 in the same table.
I still don't get your question. What are your inputs? do you want to specify a longitude and get the corresponding latitude that satisfies a specific constraint?
yes
suppose latitude is column 1 and longitude is column 2 so i wanted to extract the longitudinal value and their corresponding latitude value so that my output should come like this:
latitude longitude
0 50
10 60
30 80
40 90
50 100
0.5 50.5
10.5 60.5
20.50 70.5
40.5 90.5
and this output i wanted to store in another variable
Sorry but I still don't understand: isn't this the output you get running my code and concatenating the two outputs like this:
out = [latitude2 longitudinal2];
?

Accedi per commentare.

Categorie

Scopri di più su Vehicle Dynamics Blockset in Centro assistenza e File Exchange

Richiesto:

il 13 Ott 2019

Commentato:

il 14 Ott 2019

Community Treasure Hunt

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

Start Hunting!

Translated by