Effacer les filtres
Effacer les filtres

simulink error:Class mismatch for variable 'exist'. Expected 'logical', Actual 'double'.

8 vues (au cours des 30 derniers jours)
Wendy zhang
Wendy zhang le 3 Mai 2016
I get a error in a MATLAB function block
coder.extrinsic('exist');
N=1296;
if exist('w_1','var')
W1=w_1;
else
W1=zeros(N,1);
end

Réponses (1)

chengxuan yu
chengxuan yu le 1 Avr 2018
Modifié(e) : Walter Roberson le 1 Avr 2018
Because 'exist' return a double value and 'if' need to follow a logical value.
you can modify the code like this:
if isequal(exist('w_1','var'),1)
W1=w_1;
else
W1=zeros(N,1);
end

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by