Size mismatch when using Mex function?

I've converted a piece of matlab code to C/mex in order to improve performance of computationally intensive step. Within the algorithm, I look for a value within an array as follows:
Ck = find(COM==Cnew);
When I do this, I get the following error running the mex function..
Sizes mismatch: [1][5000] ~= [1][1]. More information Error in ClusterMex (line 73) Ck = find(COM==Cnew);
I declare Cnew at the top of a while loop as Cnew=[] in order to set its type for the C compilation and it seems to be reading it as such but when it tried to do this comparison, it is unable in the mex function.
Thanks for the help!

1 件のコメント

Walter Roberson
Walter Roberson 2017 年 9 月 28 日
What is the declared size of Ck? Did you use coder.varsize() for it?

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler についてさらに検索

質問済み:

2017 年 9 月 28 日

コメント済み:

2017 年 9 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by