I have this array and I want to trasform the value double [] in a char ''
A={[];[];'1';[];[];'3';'2';'2';'2';'3';'3';[];'2';'2';'4';'4';'2';'3';[];[];[];'1';'1';'1';'1';'1';'3';'3';'3';'3';'3';'3';'4';'4';'4';'4';[];[];[];[];[]};
I have try to use
if A==[]
A='';
end
but Matlab gives this error: 'Undefined function 'eq' for input arguments of type 'cell'. '
Can you help me?
Because you have a cell array, you don't have a choice but to loop through every entry in the cell array to replace those empty values with the empty string. Using the if
statement that way does not work as you expect. I suggest you spend time reading a MATLAB tutorial before asking more questions.
Regardless, you can do something like this:
for ii = 1 : numel(A)
if(isempty(A{ii}))
A{ii} = '';
end
end
isempty
checks to see if a matrix is empty. We check each cell for this case and if it is, replace the cell's contents with the empty string.