Why matlab 2016b makes the difference between a vector column and row vector
古いコメントを表示
>> A=[1 2 3];
>>
>> B=A';
>> B-A
ans =
0 -1 -2
1 0 -1
2 1 0
2 件のコメント
Adam
2017 年 3 月 8 日
It is nice behaviour if you are entirely understanding whether each of your vectors is a column or a row, but for those of us who had just got used to using bsxfun to do this it is unpleasant behaviour. Many a time I have had this happen when I didn't intend it because I accidentally had a row and a column instead of both the same. I would have preferred to have an error message than get a 'valid' result from this, but it is here in Matlab R2016b and beyond now, for better or for worse!
For worse.
Array broadcasting seems to appeal to users with a computer programming background, i.e. who are not MATLAB's core users anyway and are the same ones who solve everything with nested loops (because they don't understand vectorized programming), believe in mythical "one dimensional" vectors (they all have infinite dimensions. Deal with it), and who complain about one-based indexing (helloooo it is called mathematics. You might want to learn about it one day).
If I want array broadcasting then I use numpy. If I want to do mathematics then MATLAB. And unfortunately MATLAB just got less mathematical.... such a shame.
This was a change that fixed a problem that did not exist.
回答 (2 件)
Steven Lord
2017 年 3 月 8 日
0 投票
1 件のコメント
Star Strider
2017 年 3 月 8 日
I wish it was a ‘Preference’ I could deselect, or that it would at least throw a Warning.
I find it makes debugging more difficult because it allows operations that previous releases (and what I understand are the conventions of linear algebra) do not. The bsxfun function isn’t difficult to use.
James Tursa
2017 年 3 月 8 日
0 投票
Lots of discussion about this on the NG:
1 件のコメント
Steven Lord
2017 年 3 月 8 日
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!