??? Error: The expression to the left of the equals sign is not a valid target for an assignment.

10 vues (au cours des 30 derniers jours)
if obj=L;
[y fs]=wavread('tl.wav');
player=audioplayer(y,fs);
play(player)
else if obj=R;
[y fs]=wavread('tr.wav');
player=audioplayer(y,fs);
play(player)
else if obj=F;
[y fs]=wavread('mf.wav');
player=audioplayer(y,fs);
play(player)
else if obj=B;
[y fs]=wavread('mb.wav');
player=audioplayer(y,fs);
play(player)
else
[y fs]=wavread('s.wav');
player=audioplayer(y,fs);
play(player)
end
end
end
end
end

Réponse acceptée

Orion
Orion le 22 Oct 2014
Modifié(e) : Orion le 22 Oct 2014
Hi,
your else if (in C code) conditions are badly written -> elseif in matlab code.
and the conditions are not conditions. you need to use == instead of =.
something like
if obj==L;
[y,fs]=wavread('tl.wav');
player=audioplayer(y,fs);
play(player)
elseif obj==R;
[y,fs]=wavread('tr.wav');
player=audioplayer(y,fs);
play(player)
elseif obj==F;
[y,fs]=wavread('mf.wav');
player=audioplayer(y,fs);
play(player)
elseif obj==B;
[y,fs]=wavread('mb.wav');
player=audioplayer(y,fs);
play(player)
else
[y,fs]=wavread('s.wav');
player=audioplayer(y,fs);
play(player)
end

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by