Why do I have a Syntax Error?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Why is this incorrect? how do I correct this?
BuyMatrix=(k,idx(i)) (k,p(idx(i)));
Error: File: pairstrading.m Line: 204 Column: 34 Expression or statement is incorrect--possibly unbalanced (, {, or [.
all variables are correctly specified as far as i know
just a problem with syntax and brackets
thanks
2 Kommentare
Jan
am 19 Jul. 2012
This is obviously no valid Matlab syntax. As long, as you do not explain, what you wnat to achieve, it is impossible to guess ameaningful suggestion for improvement. So please clarify, what this command should do.
Akzeptierte Antwort
Kevin Claytor
am 19 Jul. 2012
What are you trying to do; access a portion of BuyMatrix, or set BuyMatrix to be a matrix? The former would be accomplished with;
BuyMatrix(k,idx(i)) = ...;
The later would be done with;
BuyMatrix = <actual matrix expression>;
Matlab doesn't really know what to do with an expression of the type;
(1,2)
Just type that in and you'll get the same error. This isn't a vector ([1,2]), and it's not telling us to access row 1, col 2 of a matrix, nor does it correspond to any other command, hence the error.
1 Kommentar
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Performance and Memory finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!