$npx -y skills add matlab/matlab-agentic-toolkit --skill matlab-sharingShare MATLAB content by guiding users through uploading to GitHub, MATLAB Drive, or File Exchange, then generating "Open in MATLAB Online" URLs. Covers the full sharing workflow: choosing a platform, uploading content (automated via gh CLI for GitHub, manual for MATLAB Drive and
| 1 | # Sharing MATLAB Content |
| 2 | |
| 3 | Share MATLAB content by uploading to GitHub, MATLAB Drive, or File Exchange, then generating "Open in MATLAB Online" URLs that let recipients open the content directly in a browser. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - User has local MATLAB files and wants to open them in MATLAB Online |
| 8 | - User wants to share MATLAB code via a link that opens in MATLAB Online |
| 9 | - AI agent generated MATLAB code locally and user wants to run/open it in MATLAB Online |
| 10 | - User asks for an "Open in MATLAB Online" link, button, or badge |
| 11 | - User has content on GitHub/MATLAB Drive/File Exchange and wants the direct-open URL |
| 12 | |
| 13 | ## When NOT to Use |
| 14 | |
| 15 | - User wants to try out MATLAB code without needing to upload anywhere |
| 16 | - User is asking about MATLAB Online features, licensing, or account setup |
| 17 | - User wants to run MATLAB code interactively in MATLAB Online without generating a shareable link |
| 18 | |
| 19 | ## Workflow |
| 20 | |
| 21 | ### 1. Identify the starting point |
| 22 | |
| 23 | Ask what the user has: |
| 24 | - **Local files only** → they need to upload first, then generate the URL |
| 25 | - **Already on GitHub** → skip to URL generation (GitHub path) |
| 26 | - **Already on MATLAB Drive with a share link** → skip to URL generation (Drive path) |
| 27 | - **Already on File Exchange** → skip to URL generation (File Exchange path) |
| 28 | |
| 29 | ### 2. Help choose a path |
| 30 | |
| 31 | If the user hasn't uploaded yet, recommend based on their goal: |
| 32 | |
| 33 | | Goal | Recommended Path | Why | |
| 34 | |------|-----------------|-----| |
| 35 | | Quick sharing or personal use | GitHub | Fully automated via CLI; works for public repos | |
| 36 | | Share with specific people (private) | MATLAB Drive | Supports access control; no public repo needed | |
| 37 | | Share with the MATLAB community | File Exchange | Discoverable by all MATLAB users; includes ratings/reviews | |
| 38 | | Embed in documentation/README | GitHub | Supports badge images in markdown | |
| 39 | |
| 40 | ### 3. Guide the upload |
| 41 | |
| 42 | Follow the appropriate path below. |
| 43 | |
| 44 | ### 4. Generate the URL |
| 45 | |
| 46 | Use the exact templates in the URL Templates section. Present the final URL to the user. |
| 47 | |
| 48 | If the user has multiple files, generate a separate URL for each file they want to open. To open all files at once: |
| 49 | - **GitHub:** omit the `file` param — clones the entire repo without opening a specific file |
| 50 | - **MATLAB Drive:** set `file=/` — opens the shared folder |
| 51 | - **File Exchange:** omit the `file` param — opens the full submission |
| 52 | |
| 53 | ### 5. Optionally generate a badge (GitHub path only) |
| 54 | |
| 55 | If the user wants a clickable button for a README: |
| 56 | |
| 57 | ```markdown |
| 58 | [](URL_HERE) |
| 59 | ``` |
| 60 | |
| 61 | ## URL Templates |
| 62 | |
| 63 | ### GitHub |
| 64 | |
| 65 | ``` |
| 66 | https://matlab.mathworks.com/open/github/v1?repo=<owner>/<repo>&file=<relative-path> |
| 67 | ``` |
| 68 | |
| 69 | | Parameter | Required | Description | |
| 70 | |-----------|----------|-------------| |
| 71 | | `repo` | Yes | `owner/reponame` (no `https://github.com/` prefix) | |
| 72 | | `host` | No | GitHub host (default: `github.com`). Required for GitHub Enterprise (e.g., `github.mathworks.com`) | |
| 73 | | `file` | No | Specific file to open after clone | |
| 74 | | `project` | No | MATLAB project file to open (e.g., `myProject.prj`) | |
| 75 | | `line` | No | Line number to navigate to | |
| 76 | | `focus` | No | Set to `true` to open in focused editor view | |
| 77 | |
| 78 | There is NO `branch` or `tag` parameter. The URL always clones the default branch. |
| 79 | |
| 80 | **URL generator tool:** Users can also generate these URLs interactively at `https://www.mathworks.com/products/matlab-online/git.html` |
| 81 | |
| 82 | ### MATLAB Drive |
| 83 | |
| 84 | ``` |
| 85 | https://matlab.mathworks.com/open/matlabdrive/v1?namespace=SHARED&id=<share-uuid>&file=<filename> |
| 86 | ``` |
| 87 | |
| 88 | | Parameter | Required | Description | |
| 89 | |-----------|----------|-------------| |
| 90 | | `namespace` | Yes | Always `SHARED` for shared content | |
| 91 | | `id` | Yes | UUID from the share link | |
| 92 | | `file` | Yes | Filename from the share link | |
| 93 | |
| 94 | The `host` parameter is optional — it defaults to `gds.mathworks.com` if omitted. |
| 95 | |
| 96 | ### File Exchange |
| 97 | |
| 98 | ``` |
| 99 | https://matlab.mathworks.com/open/fileexchange/v1?id=<submission-id> |
| 100 | ``` |
| 101 | |
| 102 | | Parameter | Required | Description | |
| 103 | |-----------|----------|-------------| |
| 104 | | `id` | Yes | Numeric submission ID from the File Exchange URL | |
| 105 | | `file` | No | Specific file to open after download | |
| 106 | | `project` | No | MATLAB project file to open | |
| 107 | | `version` | No | Specific version of the submission | |
| 108 | | `line` | No | Line number to navigate |