Skip to content

Instantly share code, notes, and snippets.

@yanndebray
Created August 12, 2025 20:30
Show Gist options
  • Select an option

  • Save yanndebray/ed6780823ecc024e5a90219091c4c89c to your computer and use it in GitHub Desktop.

Select an option

Save yanndebray/ed6780823ecc024e5a90219091c4c89c to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "812d7f50-b5e7-4102-aceb-30df592fd2ed",
"metadata": {},
"outputs": [],
"source": [
"import matlab.engine"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "15de458d-1626-44bd-b68d-5b44c3bebc22",
"metadata": {},
"outputs": [],
"source": [
"m = matlab.engine.connect_matlab()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "b8ded51c-3fda-4ea8-a84d-93cc4f4eba6d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['a', 'ans', 'b']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m.who()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "27ed28f4-ca80-4ebf-a2bc-b7b0fc6a87b9",
"metadata": {},
"outputs": [],
"source": [
"m.whos(nargout=0)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "64d53f8e-bbc4-49db-b2b0-6be841f880d5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Name Size Bytes Class Attributes\n",
"\n",
" a 1x1 8 double \n",
" ans 1x12 24 char \n",
" b 1x1 153 struct \n",
"\n",
"\n"
]
}
],
"source": [
"import io\n",
"out=io.StringIO()\n",
"m.whos(nargout=0, stdout=out)\n",
"print(out.getvalue())"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b93a42f0-2b43-4a1c-908d-af9a684866fd",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment