How to count data in a struct?

I have a struct with 61,460 lines of data that span a time period of nearly 7 years. I'm plotting a range of that data from say 4314 to 5600 using a
for i = 4314:5600,
plot(centers(i).lon, centers(i).lat, 'b*')
end
command. The struct has 6 fields of day, type, lat, lon, j and i. Lat and Lon plot the data with their respective coordinates but in the struct, there are some data sets that don't have any values of Lat or Lon, instead, in the struct, these empty spaces are filled in as "[]" or Not A Number.
Basically, I'm able to plot the range of data I want but I don't know how to count the data that's plotted on the map because between lines 2,000 and 4,000, there aren't 2,000 lines of data. How do I count the number of real data sets between a range of data and exclude non numbers or [] values.
Thanks!

2 comentarios

per isakson
per isakson el 26 de Abr. de 2019
Editada: per isakson el 26 de Abr. de 2019
See the functions
  1. isnan Array elements that are NaN
  2. isempty Determine whether array is empty
and try
sum(double( isnan( [centers.lat] )))
Proposal: Upload a small sample of the data
Marco Barron
Marco Barron el 26 de Abr. de 2019
Wow, thanks, I'll give this a shot over the weekend

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Etiquetas

Preguntada:

el 26 de Abr. de 2019

Editada:

el 26 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by