MATLAB: I am having a cell vector v= [‘1.06’ 1 1 1 1 ] i need to convert this to matrix .but the result is not the same I get v= 1 1 1 1 because the first number is different type ‘1.06’

because the first number is different type '1.06'

fprintf('\n\n*entre la fiche de matrice du tension*');
[K,M]=uigetfile;
file_name=[M,K];
v0=xlsread(file_name);

Best Answer

[~, ~, raw] = xlsread(file_name);
mask = cellfun(@ischar, raw);
raw(mask) = str2double( raw(mask) );
v0 = cell2mat(raw);