Why doesn't my matrix appear without missing columns

The matrices outputs come out wrong. Eg. I create a 3x3 matrix, but the output shows only 2 columns. I am trying to make teaching documents, but these errors keep me from doing so.
matlabprob.PNG

17 件のコメント

Bhaskar R
Bhaskar R 2020 年 1 月 14 日
編集済み: Bhaskar R 2020 年 1 月 14 日
Can you provide your created(3x3)matrix?
Raj
Raj 2020 年 1 月 14 日
"I create a 3x3 matrix, but the output shows only 2 columns" - There is no logical reason for this to happen. We can't help unless you show your process and data!
Walter Roberson
Walter Roberson 2020 年 1 月 14 日
One of the variables you used to create the matrix was empty.
Christopher Winfield
Christopher Winfield 2020 年 1 月 14 日
It happens after I use 'format rat'. The correct size of the matrix is displayed but the last column is removed.
Christopher Winfield
Christopher Winfield 2020 年 1 月 14 日
I allowed the updates but the problem persists - even after I remove 'format rat'
Christopher Winfield
Christopher Winfield 2020 年 1 月 14 日
This occurs when I am creating an .mlx file through LIVE EDITOR.
Adam Danz
Adam Danz 2020 年 1 月 14 日
編集済み: Adam Danz 2020 年 1 月 14 日
A = [1,2;3,4];
produces a 2x2 matrix
1 2
3 4
Christopher Winfield
Christopher Winfield 2020 年 1 月 14 日
編集済み: per isakson 2020 年 1 月 15 日
Try it using format rat. Someone else in our department was able to reproduce this. It presents as a clickalbe output, presenting the dimensions of the output, but not the whole output.
Adam Danz
Adam Danz 2020 年 1 月 14 日
format doesn't change the size of a variable.
format rat
A=[1,2;3, 4]
size(A) % = [2,2]
"Someone else in our department was able to reproduce this."
Perhaps there's some action being taken on the matrix but I can tell you that the matrix in your quesiton (A) is a 2x2 matix and will never be a 3x3 matrix under any format.
Walter Roberson
Walter Roberson 2020 年 1 月 14 日
Which MATLAB release are you using?
Image Analyst
Image Analyst 2020 年 1 月 15 日
Your screenshot shows you creating a 2x2 matrix with one column showing, NOT a 3x3 matrix with 2 columns showing as you said.
Anyway, I get exactly what is expected.
0000 Screenshot.png
Are you sure that you didn't create A by stitching together some column vectors with one being null, as Walter suggested?
Christopher Winfield
Christopher Winfield 2020 年 1 月 15 日
Wow. Maybe that was another example. I hope that doesn't disqualify me for addressing my problem. OMG
Christopher Winfield
Christopher Winfield 2020 年 1 月 15 日
R2019a
Christopher Winfield
Christopher Winfield 2020 年 1 月 15 日
Adam Danz
Adam Danz 2020 年 1 月 15 日
編集済み: Adam Danz 2020 年 1 月 15 日
You can see in your screen shot that A is 3x3.
Here's the output when I run that code,
However, when I resize the command window to make it narrow, I can make it appear as if A only has 2 columns (nothing changed between these 2 screen shots other than resizing the command window).
Your command window has plenty of space to the right of the 2nd column shown in your screenshot but you may want to double check that this isn't causing the issue.
Christopher Winfield
Christopher Winfield 2020 年 1 月 15 日
When I change format, the problem goes away.
Christopher Winfield
Christopher Winfield 2020 年 1 月 15 日
I think there is plenty of room now...

サインインしてコメントする。

 採用された回答

per isakson
per isakson 2020 年 1 月 15 日
編集済み: per isakson 2020 年 1 月 15 日

2 投票

The problem exists in R2018b,Win10

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 1 月 15 日

1 投票

That problem existed in your release, but was fixed by R2019b.

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by