??? Error: The expression to the left of the equals sign is not a valid target for an assignment.
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Orion
on 22 Oct 2014
Edited: Orion
on 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
0 Comments
More Answers (0)
See Also
Categories
Find more on Simscape Electrical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!