license for private toolbox

I am a software developer who has developed a private toolbox. Is there anyway I can have some kind of license control on the toolbox to prevent a customer from unrestricted distributing the toolbox.
Possible approaches: Piggy-back on the matlab license manager? A mxLicense( ) function to let me check the license number from C code?

 採用された回答

Jan
Jan 2013 年 8 月 15 日

0 投票

The license number can be check easily by using the license command in mexCallMATLAB. But this can be replaced easily by a user-defined function, such that this does not have a severe security level.
You find many discussions here and some contributions in the FileExchange for creating a unique machine ID. And internet search engine might be more efficient than the forum search.

4 件のコメント

John
John 2013 年 8 月 16 日
Thanks for the reference to mexCallMATLAB, which should work for me. However, I can't quite get it to work. Here is what I tried:
mxArray *plhs[1], *prhs[1]; int nlhs, nrhs;
nlhs = 1; nrhs = 0; mexCallMATLAB( nlhs, plhs, nrhs, prhs, "license");
mexPrintf("License number: %6s \n",plhs[0]);
I am guessing this is an issue with the type of the returned value. In the matlab GUI, license returns a char of length 6 (at least on my Win 32 system.)
Kaustubha Govind
Kaustubha Govind 2013 年 8 月 16 日
John: As the documentation says, mexPrint is an ANSI C PRINTF-style function, so you are using the formatting string %6s (which I believe is meant for character arrays) for an mxArray-pointer. If you want the equivalent of the DISP command in MATLAB, you can again call mexCallMATLAB with the "disp" command and pass in the mxArray-pointer.
Jan
Jan 2013 年 8 月 17 日
As far as I remember license replies a double. Then:
mexPrintf("License number: %g\n", mxGetScalar(plhs[0]));
John
John 2013 年 8 月 19 日
The result is not a double, but a string. The following code gets the matlab license number as a string:
mxArray *plhs[1]; char str2[16];
mexCallMATLAB( 1, plhs, 0, NULL, "license");
mxGetString( plhs[0], str2, 16 );
mexPrintf( " \n str2=%s \n", str2 );

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

質問済み:

2013 年 8 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by