I have tried following code for creating sparse graph in MATLAB:
cm = sparse([1 1 2 2 3 3 4 5],[2 3 4 5 4 5 6 6],...
[2 3 3 1 1 1 2 3],6,6)cm =
but it gives me the following error
??? [2 3 3 1 1 1 2 3],6,6)cm =
|
Error: Unexpected MATLAB expression.
I have taken this code from the official site, so I can’t understand why it produces an error.
You shouldn’t write the
cm =part at the end. That is, when you writeon the command line, you will get
This is because, you didn’t write a semicolon at the end of the statement. If you don’t want to see the value of
cm, just add a semicolon after the closing the parentheses. In addition...tells to write multi-line statement. You can writealternatively.