Why is my matrix returning a blank output?
5 views (last 30 days)
Show older comments
Brianna
on 23 Jan 2023
Commented: Walter Roberson
on 23 Jan 2023
Hi all,
This is my first time using MatLab. I commanded the concatenate two matrices together - one 3x3 and one 1x3 - to make a 4x3.
A = [1 2 3; 4 5 6; 7 8 9]
c = [2 -2 2]
After creating these matrices, I typed [A; c] to output that 4x3 matrix, but the output is entirely blank for this section? There is no error message at all either. I am completely lost on this, and help would be very much appreciated
0 Comments
Accepted Answer
Walter Roberson
on 23 Jan 2023
A = [1 2 3; 4 5 6; 7 8 9]
c = [2 -2 2]
[A; c]
You can see that for us, the code does run and produce output.
I have to wonder, though, whether what you had coded was instead
A = [1 2 3; 4 5 6; 7 8 9]
c = [2 -2 2]
[A; c];
Notice the lack of output from the [A; c] statement -- the ; at the end of the line indicates that you do not want to display the result of the calculation.
2 Comments
Walter Roberson
on 23 Jan 2023
I suggest putting a breakpoint at the line, and checking to be sure that the code is actually reaching there.
There is one (non-bug) case where ordinary display of results does not appear at the command line. That case is if you are using evalc
If you are using Live Script, then the output might appear on the side instead of inline, depending what you have configured.
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!