Can an interactive figure be exported to html?
64 次查看(过去 30 天)
显示 更早的评论
Hi, Not sure if this is feasible or not.
I would like to export an interactive figure which contains a scroll bar to html or something similar, so that the end user who does not have MATLAB can use the figure interactively.
I've found a few functions which relate to 3D plots however none are suitable for the type of figure i'm trying to export.
example code;
% Generate and plot data
x=0:1e-2:2*pi;
y=sin(x);
dx=2;
%%dx is the width of the axis 'window'
a=gca;
p=plot(x,y);
% Set appropriate axis limits and settings
set(gcf,'doublebuffer','on');
%%This avoids flickering when updating the axis
set(a,'xlim',[0 dx]);
set(a,'ylim',[min(y) max(y)]);
% Generate constants for use in uicontrol initialization
pos=get(a,'position');
Newpos=[pos(1) pos(2)-0.1 pos(3) 0.05];
%%This will create a slider which is just underneath the axis
%%but still leaves room for the axis labels above the slider
xmax=max(x);
S=['set(gca,''xlim'',get(gcbo,''value'')+[0 ' num2str(dx) '])'];
%%Setting up callback string to modify XLim of axis (gca)
%%based on the position of the slider (gcbo)
% Creating Uicontrol
h=uicontrol('style','slider',...
'units','normalized','position',Newpos,...
'callback',S,'min',0,'max',xmax-dx);
0 个评论
回答(1 个)
Rishi Binda
2018-8-28
Hello Claire,
I understand that you are looking to export a 3-D plot with interaction capability to a HTML or some other file. There are a couple of third party toolboxes that have been developed to make use of the U3D PDF-style.
This will save the figure as U3D file for inclusion as an interactive 3-dimensional figure within a PDF. This will not work for HTML.
Note that MathWorks does not guarantee or warrant the use or content of these third-party submissions. Any questions, issues, or complaints should be directed to the contributing author.
I hope this helps your issue.
2 个评论
Rishi Binda
2018-8-28
If you want the interactive figure to work on a machine without MATLAB, I suggest you to install MATLAB Compiler Runtime(MCR) on the machine. It is free and you can package your script that generates your plot as an app and distribute it.
Hope that's useful.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!