imatlab 项目教程
imatlabA Jupyter kernel for MATLAB.项目地址:https://gitcode.com/gh_mirrors/im/imatlab
1. 项目的目录结构及介绍
imatlab 项目的目录结构如下:
imatlab/
├── lib/
│ └── imatlab/
├── .gitignore
├── CHANGELOG.rst
├── LICENSE.txt
├── README.rst
├── setup.py
├── test_imatlab.py
目录结构介绍
- lib/: 包含 imatlab 的核心库文件。
- .gitignore: 用于指定 Git 版本控制系统忽略的文件和目录。
- CHANGELOG.rst: 记录项目版本变更的日志文件。
- LICENSE.txt: 项目的许可证文件,采用 MIT 许可证。
- README.rst: 项目的说明文档。
- setup.py: 用于安装项目的脚本文件。
- test_imatlab.py: 项目的测试脚本。
2. 项目的启动文件介绍
项目的启动文件是 setup.py
。该文件用于安装 imatlab 项目,并注册 Jupyter 内核。
启动文件内容
from setuptools import setup
setup(
name='imatlab',
version='0.1',
description='A Jupyter kernel for MATLAB',
author='imatlab',
url='https://github.com/imatlab/imatlab',
packages=['imatlab'],
install_requires=[],
entry_points={
'console_scripts': [
'imatlab=imatlab:main',
],
},
)
使用方法
$ pip install imatlab # 从 PyPI 安装
$ pip install git+https://github.com/imatlab/imatlab # 从 GitHub 安装
$ python -m imatlab install # 注册内核
3. 项目的配置文件介绍
项目的配置文件主要是 setup.py
和 README.rst
。
setup.py
该文件用于安装和配置 imatlab 项目。它定义了项目的名称、版本、描述、作者、URL 等信息,并指定了安装依赖和入口点。
README.rst
该文件是项目的说明文档,包含了项目的安装方法、使用方法、功能介绍等内容。
配置文件内容
A Jupyter kernel for MATLAB
===========================
Note: This package is no longer actively maintained. Consider using the official MATLAB integration for Jupyter instead.
Installation
------------
As usual, install using pip:
.. code-block:: bash
$ pip install imatlab # from PyPI
$ pip install git+https://github.com/imatlab/imatlab # from Github
Then register the kernelspec with:
.. code-block:: bash
$ python -m imatlab install
In the absence of administrator rights, the --user flag should be added to all of these commands.
Use
---
# Notebook (in the notebook interface, select Matlab from the 'New' menu):
$ jupyter notebook
# or QtConsole:
$ jupyter qtconsole --kernel imatlab
# or terminal:
$ jupyter console --kernel imatlab
(Note that imatlab intentionally does not declare a dependency on any Jupyter client as it can be used with any one of them individually. In practice, this means that at least one of jupyter-notebook, jupyter-qtconsole, or jupyter-console need to be installed in addition to imatlab.)
Inline graphics
---------------
MATLAB figures can be displayed in native MATLAB windows (the default) or (when using the notebook) as inline images. The kernel can natively display static images or use Plotly to generate interactive JavaScript figures. The exporter is set by calling the imatlab_export_fig function which is automatically added to the MATLAB path when the kernel is running. The following settings are possible:
.. code-block:: matlab
imatlab_export_fig('') % Native windows
imatlab_export_fig('fig2plotly') % Plotly figures
imatlab_export_fig('print-png') % Static images
以上是 imatlab 项目的目录结构、启动文件和配置文件的介绍。希望这份教程能帮助你更好地理解和使用 imatlab 项目。
imatlabA Jupyter kernel for MATLAB.项目地址:https://gitcode.com/gh_mirrors/im/imatlab