MATLAB: I need help converting cells of complexes into real/imaginary matrices

cell arraysMATLABmatrix

Dear Colleagues,
I'm trying to real admittance matrix from csv/excel form into matlab workspace.
I was able to get
ddd =
{["0.00 – j17.36" ]} {["" ]} {["" ]} {["-0.00 + j17.36"]} {["" ]} {["" ]}
{["" ]} {["0.00 – j16.00" ]} {["" ]} {["" ]} {["" ]} {["" ]}
{["" ]} {["" ]} {["0.00 – j17.06" ]} {["" ]} {["" ]} {["" ]}
{["-0.00 + j17.36"]} {["" ]} {["" ]} {["4.06 – j42.10" ]} {["-2.12 + j14.39"]} {["-1.94 + j10.51"]}
{["" ]} {["" ]} {["" ]} {["-2.12 + j14.39"]} {["3.30 – j20.13" ]} {["" ]}
{["" ]} {["" ]} {["" ]} {["-1.94 + j10.51"]} {["" ]} {["3.17 – j15.73" ]}
{["" ]} {["-0.00 + j16.00"]} {["" ]} {["" ]} {["-1.19 + j5.98" ]} {["" ]}
{["" ]} {["" ]} {["" ]} {["" ]} {["" ]} {["" ]}
{["" ]} {["" ]} {["-0.00 + j17.06"]} {["" ]} {["" ]} {["-1.23 + j5.48" ]}
I'm trying to change this cell array into matrices of real and imaginary numbers.
But cell2mat or str2double doesn't work with my data.
Is there anyone who already faced this issue?
Thank you in advance.

Best Answer

str2double( regexprep(cellstr(ddd), 'j(.*)', '$1i', 'once'))
If you want the empty cells to be converted to 0 then
str2double(regexprep(cellstr(ddd), {'j(.*)','^$'}, {'$1i', '0'}, 'once', 'emptymatch'))