Dear all, Could you please help me that I faced the difficulty to do the data set to be tidy up? I want to delete the empty fields in the data set. The data set(53x2 cell array) is below;
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[] []
[1x18 struct] []
[] []
[1x18 struct] []
[] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[] []
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[] []
[1x18 struct] [1x18 struct]

댓글 수: 2

Is it a cell array or what? What is its size? do you mean to delete the entire row?
this data set is 53x2 Cell Array,sir. I want to delete only these empty fields showed below:

댓글을 달려면 로그인하십시오.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 27일

0 개 추천

V={5 [];4 6;[] 8;7 8;[] []}
idx=cellfun(@isempty,V)
V(any(idx,2),:)=[]

댓글 수: 3

Thanks sir,it deletes the entire row that is specified . But I just want to delete the only empty fields ,sir.So , I need to do 53x2 cell array to Nx1 cell array firstly and to delete the empty rows ,sir.Thank for your kind help.
Dear Azzi Abdelmalek , May i also know how to reduce the empty fields of array.I have the array [1 0 0 2 3 5 6 0 2 8 0].I want to delete these empty columns of this array.It is so easy for you,i think.Please help me,sir.
If there are empty element, that means you haven't to delete them, because they don't exist, unless you mean to delete the zero elements, in this case
array=[1 0 0 2 3 5 6 0 2 8 0]
out=nonzeros(array)'

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Elias Gule
Elias Gule 2016년 4월 29일

0 개 추천

Now, try this
V = {1,2,[],[],23,16,'A',struct()}; % your cell array
V = V(~cellfun('isempty'),V);

댓글 수: 2

THanks sir.
Plz replace
V = V(~cellfun('isempty'),V);
with
V = V(~cellfun('isempty',V));

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2016년 4월 27일

댓글:

2016년 5월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by