Access Values of Cell Array deeply nested within Structure Array

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Access Values of Cell Array deeply nested within Structure Array

babelproofreader
I have a nested structure_array/cell_array/structure_array of character
values which is the result of a web query which returns a converted JSON
object, the needed numeric value(s) of which I can access in a loop thus:

str2double( S.orderBook.buckets{ loop_ix }.price )

However, I was wondering whether there is a quicker/more elegant way of
getting these values? At the moment, for my purposes, I am having to run a
"look up" for loop that encloses an "if statement" to get in the ballpark of
the required numeric values, and then run a second for loop in the region of
the ballpark to extract these required values.

Note: Cross posted at
https://stackoverflow.com/questions/61233692/access-values-of-cell-array-deeply-nested-within-structure-array
<https://stackoverflow.com/questions/61233692/access-values-of-cell-array-deeply-nested-within-structure-array>  




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Access Values of Cell Array deeply nested within Structure Array

Octave - General mailing list
maybe this can help

https://stackoverflow.com/questions/60927436/octave-cell-array-with-cells-to-concatenate


On 15/04/2020 20:22, babelproofreader wrote:

> I have a nested structure_array/cell_array/structure_array of character
> values which is the result of a web query which returns a converted JSON
> object, the needed numeric value(s) of which I can access in a loop thus:
>
> str2double( S.orderBook.buckets{ loop_ix }.price )
>
> However, I was wondering whether there is a quicker/more elegant way of
> getting these values? At the moment, for my purposes, I am having to run a
> "look up" for loop that encloses an "if statement" to get in the ballpark of
> the required numeric values, and then run a second for loop in the region of
> the ballpark to extract these required values.
>
> Note: Cross posted at
> https://stackoverflow.com/questions/61233692/access-values-of-cell-array-deeply-nested-within-structure-array
> <https://stackoverflow.com/questions/61233692/access-values-of-cell-array-deeply-nested-within-structure-array>  
>
>
>
>
> --
> Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
>
>
--
Greta & Patrick Pintelon
[hidden email]
[hidden email]