Numbers to scientific 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;

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by