Can an interactive figure be exported to html?
64 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Rishi Binda
am 28 Aug. 2018
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 Kommentare
Rishi Binda
am 28 Aug. 2018
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.
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!