Accessing org.postgresql.util.PGobjects in Matlab tables
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
HI - I'm having a dificult time figuring out how to accessing the packed data below in 'check.data' that are long cells. I've been trying functions like cell2mat with out any luck. The common error I get is that 'Brace indexing is not supported for variables of this type'. Any help appreciated. Many thanks!
>> check = Narwhal(Narwhal.namespaced_collection=="shorebirds.check",:);
>> size(check.data)
ans =
1507 1
>> check.data(1:3)
ans =
3×1 cell array
{1×1 org.postgresql.util.PGobject}
{1×1 org.postgresql.util.PGobject}
{1×1 org.postgresql.util.PGobject}
>> check.data{1:3}
ans =
{"date": 1597862119404, "notes": "Greg testing", "nest_id": "0899094c-b5a0-4792-80d0-bad71d42d1a6", "sdzg_int": {"incubating": null, "nest_status": []}, "global_id": "a25a1121-2dfd-4091-a8d0-d5aee033b016", "populations": {"core": {"core_membership": {"isSample": true}}, "sdzg_int": {"sdzg_membership": {"isSample": true}}, "shorebirds": {"check_membership": {"isSample": true}}}, "eggs_abandoned": null, "date_time_created": 1597862119404}
ans =
{"date": 1586972714082, "notes": null, "nest_id": "2f3ece70-83ca-4a2b-a26d-5d82a460a095", "sdzg_int": {"nest_status": []}, "global_id": "616f9bc3-2668-4450-8a20-3c362e5c66e4", "populations": {"core": {"core_membership": {"isSample": true}}, "sdzg_int": {"sdzg_membership": {"isSample": true}}, "shorebirds": {"check_membership": {"isSample": true}}}, "eggs_abandoned": null, "date_time_created": 1586972714083}
ans =
{"date": 1588707892420, "notes": null, "nest_id": "96863fcc-bd8d-4534-9ade-ddb9f5f92c25", "sdzg_int": {"incubating": null, "nest_status": []}, "global_id": "f20afda4-890c-4d2d-a59a-60f18eec8785", "populations": {"core": {"core_membership": {"isSample": true}}, "sdzg_int": {"sdzg_membership": {"isSample": true}}, "shorebirds": {"check_membership": {"isSample": true}}}, "eggs_abandoned": null, "date_time_created": 1588707892421}
0 Kommentare
Antworten (1)
Mrunmayee Gaikwad
am 27 Nov. 2020
Hey,
The function cell2mat works when the cell array data is of numeric type. As the 'check.data' is not of numeric type, it will give an error.
To access data from a cell array use curly braces. For example, check.data{1,1} will let you access the data from first row and first column, check.data{2,1} will let you access the data from second row and first column.
You can also access this data by converting the cell array to a table using the cell2table function.
You can check the documentation links on how to access data in cell array and using the cell2table function.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Categorical Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!