coder.opaque + persistent statements at once

Can I make in Matlab Codder a function variable that is both persistent (Static) and has specified type like int16?
persistent variable;
variable= coder.opaque('int');
Gives me coder error:
??? Class mismatch (coder.opaque ~= double).
The class to the left is the class of the left-hand side of the assignment.
Also I cannot define anything before declaring it persistent so swapping lines doesn't help :-)

 採用された回答

Ryan Livingston
Ryan Livingston 2013 年 7 月 22 日

2 投票

You should be able to do something like:
persistent var;
if isempty(var)
var = zeros('int16');
end
... use var ...
in your code. Then, "var" will be int16 and persistent.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Deployment, Integration, and Supported Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by