フィルターのクリア

How to remove the last column in an array

33 ビュー (過去 30 日間)
kavitha subramaniam
kavitha subramaniam 2014 年 10 月 28 日
回答済み: James Tursa 2014 年 10 月 28 日
How to remove the last column in this array?
a=[1 2 3 4
5 6 7 8
9 1 2 3
4 5 6 7];
Resultant array is
a=[1 2 3
5 6 7
9 1 2
4 5 6];

回答 (2 件)

Julia
Julia 2014 年 10 月 28 日
Hi again,
I think you should read a bit abot the ":"-operator, it is quite helpful ;)
a =
1 2 3 4
5 6 7 8
9 1 2 3
4 5 6 7
>> a=a(:,1:end-1)
a =
1 2 3
5 6 7
9 1 2
4 5 6
I also answered your last question. Did it help you? If so, please accept my answer, so other users know, that this solves the issue.

James Tursa
James Tursa 2014 年 10 月 28 日
Another method:
a(:,end) = [];

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by