Get a mwArray string filed value (string lenght unknown)

18 ビュー (過去 30 日間)
adp
adp 2020 年 9 月 25 日
編集済み: Anjaneyulu Bairi 2024 年 11 月 1 日 16:54
if I have an mwArray which is a structure, how can I copy a string field (i dont'know lenght of the string) of this structure to a C++ string?
thank you

回答 (1 件)

Anjaneyulu Bairi
Anjaneyulu Bairi 2024 年 11 月 1 日 16:54
編集済み: Anjaneyulu Bairi 2024 年 11 月 1 日 16:54
Hi,
You can follow below steps to access the string field from "mwArray" structure:
  • mwString GetFieldName(int index) : This method returns the string by passing the index of the string field in your strucutre
  • Convert above "mwString" to character pointer like below :
const char* strPtr = (const char*)mwStr
  • Now convert above character pointer to string using "string" function in C++. For example
string fieldString(strPtr); // where strPtr is your character pointer
Now, you can perform the desired operations on created string.
Refer the below documentation link on "mwArray" for more information:
I hope this helps!

カテゴリ

Help Center および File ExchangeDeploy to C++ Applications Using mwArray API (C++03) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by