Hi, i have a cell array 'a' which is of the form as shown below. I wanted to remove the empty cells from the cell array keep the elements corresponding to the row together one after another in 'b'. Can anyone help me to modify the code to get the 'desired_output' ? Any help will be appreciated
a =cell(1)a{1,1} = 5a{1,2} = 9a{1,3} = 10a{1,4} = 11a{2,1} = 23a{2,2} = 45a{3,1} = 100a{3,2} = 89a{3,3} = 123b = a(~cellfun('isempty',a))
'current_output'b = 9×1 cell array {[ 5]} {[ 23]} {[100]} {[ 9]} {[ 45]} {[ 89]} {[ 10]} {[123]} {[ 11]}
'desired_output 'd = d = 9×1 cell array {[ 5]} {[ 9]} {[ 10]} {[ 11]} {[ 23]} {[ 45]} {[100]} {[ 89]} {[123]}
Best Answer