today i have something nice! i needed to export a simulink modell to powerpoint, and i did not want to make a screen shot. the clue is saveppt.
to use the program, i typed:
saveppt('test.ppt','title of the slide','-sTheNameOfTheModell')
just another blog. here you'll find my experiences with Matlab/Simulink, vba, LaTeX and Mac OS X.
function carpetplot(data,FigNr,colormap)
max_zeilen = 24*4;
zeile=1;
spalte=1;
i=1;
while spalte <= 365,
while zeile <= max_zeilen,
DATA(zeile,spalte)=data(i);
zeile=zeile+1;
i=i+1;
end
spalte=spalte+1;
zeile=1;
end
x=[1:1:365];
y=[0:(1/(4)):24-1/(4)];
figure(FigNr)
clf
axes1 = axes(...
'FontSize',16,...
'LineWidth',1,...
'Box','on',...
'Parent',figure(FigNr));%,...
% 'CLim',[-20000 -5000]);
xlabel(axes1,'Tag im Jahr');
ylabel(axes1,'Uhrzeit');
grid(axes1,'off');
hold(axes1,'all');
set(gca,'XLim',([1 365]),'YLim',([0 (24-1/(4*60))]))%,'ZLim',([-20000 -5000]))
surf(x,y,DATA,'EdgeColor','none',...
'LineWidth',1,'Parent',axes1);
view(0,90)
colorbar1 = colorbar('peer',...
axes1,'EastOutside',...
'Box','on',...
'FontSize',16,...
'XLim',[-0.5 1.5], 'YLim', [-20000 -5000],...
'CLim',[0 6]);
%load('MyColormaps','mycmap')
set(figure(FigNr),'Colormap',colormap)
% set(axes1,'CLim', [0 4])
Published with MATLAB® 7.5
===
>> edit hgexport
===
fig2png(gcf,'fig1.png','style_FfE_ppt')
function fig2png(figname,filename,sname)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% tmezger@ffe.de
% 08.11.2007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%this function exports the figure figname to a file filename, using the
%style sname
% the style hast to be in your matlab home!!!
%% check if figure is docked
if strcmpi(get(figname,'WindowStyle'),'docked')
undock = 1;
else
undock = 0;
end
%% set style
s=hgexport('readstyle',sname);
%% undock
if undock == 1
disp(['undocking figure ' figname])
set(figname,'WindowStyle','normal')
end
%% export to filename
hgexport(figure(1),filename,s)
disp('file written')
%% export to clipboard
hgexport(figure(1),'-clipboard',s)
disp('exported to clipboard')
%% dock aggain if it was docked
if undock == 1
set(figname,'WindowStyle','docked')
disp(['docking figure ' figname ' aggain'])
end
data(isnan(data)) = 0; % convert NaN into 0!!!!have a while!