필터 지우기
필터 지우기

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 CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by