フィルターのクリア

Boolean matrix in mex file

7 ビュー (過去 30 日間)
Alessandro Masullo
Alessandro Masullo 2015 年 2 月 24 日
コメント済み: Alessandro Masullo 2015 年 2 月 24 日
Hello everyone,
I'm trying to read a logical matrix in a mex file with matlab. The way I usally do for reading matrices in matlab is:
double *var = mxGetPr(prhs[0]);
If the variable in matlab is logic, I get weird results in C++, but if I try to initialize var as boolean:
bool *var = mxGetPr(prhs[0]);
I get:
error C2440: 'initializing' : cannot convert from 'double *' to 'bool *'
The only solution I've found, for the moment, is passing the logical matrix as double to the mex routine, but I'd prefer reading the boolean matrix instead.
How can I do that?
Alessandro.

採用された回答

Titus Edelhofer
Titus Edelhofer 2015 年 2 月 24 日
Hi Alessandro,
use mxGetLogicals instead of mxGetPr ...
Titus
  1 件のコメント
Alessandro Masullo
Alessandro Masullo 2015 年 2 月 24 日
Thank you, I didn't know about that one.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by