poster
2019-12-10, 16:49
我想从MATLAB中 (http://en.wikipedia.org/wiki/MATLAB)的脚本显示表格。我可以轻松生成和其他HTML元素,但是据我所知,我只能将它们写入文件。
有没有一种方法可以显示来自MATLAB的HTML(或其他标记)?还是我坚持写文件并打开浏览器?
回答:
使用MATLAB图形中的Java Swing组件,使用MATLAB的javacomponent()函数精确地使用JEditorPane 。 JEditorPane支持HTML的良好子集。
https://i.stack.imgur.com/Bx4Wu.gif (https://i.stack.imgur.com/Bx4Wu.gif)
这是一个代码示例:
mytext = 'MonthSavingsJanuary$100'; hfig = figure(); je = javax.swing.JEditorPane( 'text/html', mytext ); jp = javax.swing.JScrollPane( je ); [hcomponent, hcontainer] = javacomponent( jp, [], hfig ); set( hcontainer, 'units', 'normalized', 'position', [0,0,1,1] ); %# Turn anti-aliasing on ( R2006a, java 5.0 ) java.lang.System.setProperty( 'awt.useSystemAAFontSettings', 'on' ); je.putClientProperty( javax.swing.JEditorPane.HONOR_DISPLAY_PROPERTIES, true ); je.putClientProperty( com.sun.java.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY, true ); je.setFont( java.awt.Font( 'Arial', java.awt.Font.PLAIN, 13 ) ); 编辑:在这里 (http://undocumentedmatlab.com/blog/gui-integrated-html-panel/)查看此解决方案的讨论,
更多&回答... (https://stackoverflow.com/questions/1903516)
有没有一种方法可以显示来自MATLAB的HTML(或其他标记)?还是我坚持写文件并打开浏览器?
回答:
使用MATLAB图形中的Java Swing组件,使用MATLAB的javacomponent()函数精确地使用JEditorPane 。 JEditorPane支持HTML的良好子集。
https://i.stack.imgur.com/Bx4Wu.gif (https://i.stack.imgur.com/Bx4Wu.gif)
这是一个代码示例:
mytext = 'MonthSavingsJanuary$100'; hfig = figure(); je = javax.swing.JEditorPane( 'text/html', mytext ); jp = javax.swing.JScrollPane( je ); [hcomponent, hcontainer] = javacomponent( jp, [], hfig ); set( hcontainer, 'units', 'normalized', 'position', [0,0,1,1] ); %# Turn anti-aliasing on ( R2006a, java 5.0 ) java.lang.System.setProperty( 'awt.useSystemAAFontSettings', 'on' ); je.putClientProperty( javax.swing.JEditorPane.HONOR_DISPLAY_PROPERTIES, true ); je.putClientProperty( com.sun.java.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY, true ); je.setFont( java.awt.Font( 'Arial', java.awt.Font.PLAIN, 13 ) ); 编辑:在这里 (http://undocumentedmatlab.com/blog/gui-integrated-html-panel/)查看此解决方案的讨论,
更多&回答... (https://stackoverflow.com/questions/1903516)