フィルターのクリア

Remove columns for a cell array

67 ビュー (過去 30 日間)
Joseph Lee
Joseph Lee 2017 年 12 月 11 日
回答済み: Hedayat 2019 年 11 月 28 日
Z= {10x3000}
how do i trim away 1000 columns to
Z={10x2000}

採用された回答

per isakson
per isakson 2017 年 12 月 11 日
編集済み: per isakson 2017 年 12 月 11 日
One way
>> cac = cell(10,3000);
>> cac = cac(:,1:end-1000);
>> size(cac)
ans =
10 2000
>>
and another
cac = cell(10,3000);
cac(:,2001:end) = [];
whos cac
Name Size Bytes Class Attributes
cac 10x2000 160000 cell

その他の回答 (2 件)

James Tursa
James Tursa 2017 年 12 月 11 日
Not sure what Z really is from your description. Maybe one of these will work for you:
Z(:,2001:end) = []; % assumes Z is a cell array of size 10x3000
or maybe
Z{1}(:,2001:end) = []; % assumes Z is a single cell with a 10x3000 array inside of it

Hedayat
Hedayat 2019 年 11 月 28 日
If you want to delete more than one rows of cell you can ...
a= cell(5,5)
a =
5×5 cell array
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
a([2,3],:)=[]
a =
3×5 cell array
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by