MATLAB: Numbers to scientific notation.

MATLABscientific notation

In table Ft i would like to have the numbers in scientific notation, what is the right way to do that?
clearvars
close all
clc
map=18;
spoormodel=map;
path='X:\5. Data\Spoormodel\';
if map < 10
filelocation_mat = [path,'0',num2str(map),'_rf.mat'];
filelocation_csv = [path,'0',num2str(map),'_rf.csv'];
elseif map > 09
filelocation_mat = [path,num2str(map),'_rf.mat'];
filelocation_csv = [path,num2str(map),'_rf.csv'];
end
if exist (filelocation_mat)
load(filelocation_mat);
ja='ja';
elseif exist(filelocation_csv)
reactionforce = csvread (filelocation_csv,2,0);
reactionforce = array2table(reactionforce);
vars = csvread (filelocation_csv,1,1,[1,1,1,width(reactionforce)-1]);
clear map path filelocation_csv
save (filelocation_mat);
else
error('bestand bestaat niet')
end
%end
if isequal(map,3)
spec = '120kmh';
elseif isequal(map,4)
spec = '45kmh,120%';
elseif isequal(map,5)
spec = '120kmh,120%';
elseif isequal(map,7)
spec = 'Overweg, 120km/h, 120%';
elseif isequal(map,8)
spec = 'Overweg, 120km/h';
elseif isequal(map,9)
spec = 'Overweg 80km/h';
elseif isequal(map,10)
spec = '80kmh,120%,';
elseif isequal(map,11)
spec = '80kmh,120%,overweg';
elseif isequal(map,12)
spec = '80kmh';
elseif isequal(map,13)
spec = '45kmh,120%,overweg';
elseif isequal(map,14)
spec = '45kmh, overweg';
elseif isequal(map,15)
spec = '45kmh';
elseif isequal(map,16)
spec = '60kmh overweg';
elseif isequal(map,17)
spec = '60 kmh';
elseif isequal(map,18)
spec = '100kmh overweg';
elseif isequal(map,19)
spec = '100kmh';
end
time = table2array(reactionforce(1:end,1));
reactionforce(:,1)=[];
sort = vars == 152783 | vars == 153121;
vars = array2table(vars);
vars = vars{:,sort};
%reactionforce = table2array(reactionforce)
data = table2array(reactionforce(1:end,sort));
Ft.time = num2str(time);
Ft.n152783 = num2str(data(:,1),3);
Ft.n153121 = num2str(data(:,2),3);
%format shortEng
test = 30000000000000;
Ft = struct2table(Ft);
%Ft = uitable(Ft);
cmap = colormap(parula(size(vars,2)));
%vars=num2cell(vars);
subplot(211,'colororder',cmap);hold on;
%title('Massa -20%');
plot(time,data)
title(['Spoormodel ', num2str(spoormodel),' - ',spec]);
%legend(vars);
legend( sprintf('%g\n', vars))
grid on;
axis tight;
xlim([0 2])
xlabel('tijd [s]')
ylabel('reactiekracht [N]')
%legend(sprintf('%g\n',vars))
hold on;

Best Answer

See Format