Select data by attributes

2 visualizaciones (últimos 30 días)
Claudia
Claudia el 21 de Mayo de 2012
Hi
I have a 24000x1 Geographic Data Structure (let's call it "Polylines" with more than 20 attribute fields. I always only like to do calculations with some of the data of this stucture. Let's say I have the field "Accuracy" and now I only like to do calculation with the data which have the string "acc" in that field. I am not sure if it is important but the structure is an element-by-element-organization. How can I select these data? Thank you for your help, Claudia

Respuesta aceptada

Geoff
Geoff el 21 de Mayo de 2012
Do you mean you have a structure:
Polylines.Accuracy
Polylines.SomeOtherField1
Polylines.SomeOtherField2
... etc
And the Polylines.Accuracy field is exactly equal to the string 'acc' for all the rows you're interested in?
And the Polylines.Accuracy field is perhaps a cell array?
IF that were the case, you could do this:
validRows = strcmp( Polylines.Accuracy, 'acc' );
And then use that as a logical index on all fields you are interested in.
  8 comentarios
Claudia
Claudia el 21 de Mayo de 2012
Hi Geoff
just watched a video about struct and arrays.
I already tried to change the organization
from 'array of struct' (synonym for 'element-by-element organization', yes?)
to 'struct of array' (synonym for 'plane organization', yes?)
It did not work. I posted the question but could not get an answer. It was not me who created the file.
Do you know how I can change it afterwards?
That would be great!
I go home now and wish you a nice day or evening, wherever you are :-)
Cheers, Claudia
Claudia
Claudia el 21 de Mayo de 2012
Hi Geoff
I woke up this morning and knew the answer :-)
Now I gave the "{ Polylines.ACCURACY} " command in a similar way to all attributes and then I created the struct again with "Polylines.ACCURACY = ACCURACY" and so on for all attributes.
Thank you for putting me in the right way!
Cheers, Claudia

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by