ERROR: Wavelet + MATLAB Coder

1 回表示 (過去 30 日間)
Nycholas Maia
Nycholas Maia 2018 年 5 月 1 日
コメント済み: Nycholas Maia 2018 年 5 月 23 日
I'm trying to convert my function called myFunc to C. The 'signal' input argument is a vector (1000, 1) that contains only uint16 numbers.
function [out] = myFunc(signal)
[c,l] = wavedec(signal, 8, 'db8');
[out] = detcoef(c,l, 4);
end
When I tried to convert this MATLAB function to a C function, I got a error inside the: wavedec.m - Line 29
This assignment writes a 'double' value into a 'single' type. Code generation does not support changing types through assignment. Check preceding assignments or input type specifications for type mismatches.
Line 29:
c = zeros(0,1);
When I put my mouse over the 'c' variable on the error window, MATLAB shows me that this 'c' variable is single type and 'zeros(0, 1)' return a double type.
Could you please help me to convert this function to a C file?

回答 (1 件)

Arnab De
Arnab De 2018 年 5 月 9 日
There must be other assignments to the variable 'c' where the assigned value is single. If you want 'c' to be single, change the line 29 to
c = zeros(0,1,'single');
  3 件のコメント
Arnab De
Arnab De 2018 年 5 月 22 日
Ah! My bad. Can you please post the codegen command you are using? According to the doc (https://www.mathworks.com/help/wavelet/ref/wavedec.html), signal should be double vector.
Nycholas Maia
Nycholas Maia 2018 年 5 月 23 日
Yes, the signal input argument is already double.
I'm not using codegen by command window. I'm using MATLAB Coder app (GUI), so I don't have the codegen command.
Do you have any idea?

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

カテゴリ

Help Center および File ExchangeContinuous Wavelet Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by