Construct String for Query

18 ビュー (過去 30 日間)
Philippe Walliser
Philippe Walliser 2019 年 5 月 27 日
コメント済み: Philippe Walliser 2019 年 5 月 27 日
I am querying a remote MongoDB Database within Matlab using the Matlab Database Toolbox interface for MongoDB.
Queries tipically look like this:
query5473 = '{"_ref":{$oid:"5ce3e0ec620ea1990ce172177"}, "eventTypeId":5473}';
However, I would like to not manually type the ID but rather use the some element from an array like this:
queryExample = '{"_ref":{$oid:SomeArray(1)}, "eventTypeId":5473}';
Unfortunatelly this results in an error.
Could someone help me out?

採用された回答

Walter Roberson
Walter Roberson 2019 年 5 月 27 日
query5473 = sprintf('{"_ref":{$oid:"%s"}, "eventTypeId":5473}', SomeArray{1})
  1 件のコメント
Philippe Walliser
Philippe Walliser 2019 年 5 月 27 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by