MATLAB Answers

Accessing org.postgr​esql.util.​PGobjects in Matlab tables

2 ビュー (過去 30 日間)
Ignacio Vilchis
Ignacio Vilchis 2020 年 10 月 21 日
回答済み: Mrunmayee Gaikwad 2020 年 11 月 27 日
HI - I'm having a dificult time figuring out how to accessing the packed data below in '' 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(
ans =
1507 1
ans =
3×1 cell array
{1×1 org.postgresql.util.PGobject}
{1×1 org.postgresql.util.PGobject}
{1×1 org.postgresql.util.PGobject}
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 件のコメント


回答 (1 件)

Mrunmayee Gaikwad
Mrunmayee Gaikwad 2020 年 11 月 27 日
The function cell2mat works when the cell array data is of numeric type. As the '' is not of numeric type, it will give an error.
To access data from a cell array use curly braces. For example,{1,1} will let you access the data from first row and first column,{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 件のコメント





Community Treasure Hunt

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

Start Hunting!

Translated by