- Get rid of the open brace {
- Replace the close brace } with end
Invalid Syntax at '='.Possibly,a ),} or ] is missing at line 6 .
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
swathi sunkaraboina
le 6 Fév 2019
Modifié(e) : James Tursa
le 6 Fév 2019
function [y1,y2,y3] = fnc(u)
%#codegen
y1=0;y2=0;y3=0;
if 0<=u<=(pi/3)
{
y1=1; ----------------------Error:Invalid Syntax at '='.Possibly,a ),} or ] is missing at line 6
y2=-1;
y3=0
}-------------------------Error:Parse error at }:Usage might be invalid Matlab syntax.
if((pi/3)<u<=(2*pi/3))
{y1=1;
y2=0;
y3=-1;
}
if((2*pi/3)<u<=(pi))
{y1=0;
y2=1;
y3=-1;
}
end;
0 commentaires
Réponse acceptée
James Tursa
le 6 Fév 2019
Modifié(e) : James Tursa
le 6 Fév 2019
The { } formulation for blocking code is not valid MATLAB syntax. To fix this:
I.e., instead of
if something
{
stuff;
}
Do this
if something
stuff;
end
1 commentaire
Steven Lord
le 6 Fév 2019
In addition to what James wrote, this syntax doesn't do what I believe you think it does.
if 0<=u<=(pi/3)
If you open that file in the MATLAB Editor, you should see a Code Analyzer message on those lines explaining what it does and how to do what you want. I believe there may even be an auto-fix available.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps 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!