opentoline — Open a file to a requested editor line in MATLAB-compatible code.
opentoline(filename,line) resolves a file and validates a host-safe editor-navigation request. RunMat runtimes are noninteractive, so successful calls complete without launching an editor.
Syntax
opentoline(filename, line)
opentoline(filename, line, column)
opentoline(filename, line, column, option)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
filename | StringScalar | Yes | — | File to open in the editor. |
line | NumericScalar | Yes | — | One-based line number. |
column | NumericScalar | No | 1 | One-based column number. |
option | StringScalar | No | — | Editor navigation option such as 'select'. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:opentoline:ArgumentCount | The call does not provide two to four input arguments. | opentoline: expected filename, line, optional column, and optional option |
RunMat:opentoline:InvalidFilename | The filename is not a string scalar or row character vector. | opentoline: filename must be a character vector or string scalar |
RunMat:opentoline:InvalidPosition | The line or column argument is not a positive integer scalar. | opentoline: line and column must be positive integer scalars |
RunMat:opentoline:InvalidOption | The optional editor behavior argument is unsupported. | opentoline: option must be 'select' when provided |
RunMat:opentoline:FileNotFound | No file matching the supplied name can be resolved. | opentoline: file was not found |
RunMat:opentoline:TooManyOutputs | The call requests one or more output arguments. | opentoline: expected no output arguments |
How opentoline works
opentoline(filename,line)accepts a string scalar, row character vector, or scalar string array filename plus a positive integer line number.opentoline(filename,line,column)also validates a positive integer column number.opentoline(filename,line,column,'select')accepts MATLAB-style selection intent as a no-op navigation option in noninteractive hosts.- Command-style numeric line and column arguments passed as text, such as
opentoline file.m 10 4, are accepted when they parse as positive integers. - File names are resolved using the RunMat search path and the same general MATLAB-style file extensions used by
open. - A missing file raises
RunMat:opentoline:FileNotFound. - Non-scalar, nonfinite, fractional, zero, or negative line and column values raise
RunMat:opentoline:InvalidPosition. - Requesting output arguments raises
RunMat:opentoline:TooManyOutputs.
Does RunMat run opentoline on the GPU?
opentoline is a host-side editor navigation operation and does not participate in GPU fusion or provider-native execution.
Examples
Open a script at a line
opentoline('setup.m', 12)Expected output:
% setup.m is resolved and the editor-navigation request succeeds without returned output.Open a script at a line and column
opentoline('setup.m', 12, 4)Expected output:
% RunMat validates the file, line, and column.Use command-style text numbers
opentoline setup.m 12 4Expected output:
% Text line and column arguments are parsed as positive integers.Using opentoline with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how opentoline changes the result.
Run a small opentoline example, explain the result, then change one input and compare the output.
FAQ
Does opentoline launch a desktop editor?⌄
No. RunMat's runtime implementation is host-safe and noninteractive. It resolves the file and validates the requested position; the actual editor navigation completes as a no-op.
Why is this builtin under io/repl_fs instead of plotting?⌄
opentoline is an editor/file navigation helper. It appeared in a plotting/UI token bucket, but its runtime ownership belongs with REPL-facing filesystem and editor-style operations.
Related Io functions
Repl Fs
addpath · cd · copyfile · delete · dir · exist · fileattrib · fileparts · fullfile · genpath · getenv · getpref · isenv · isfile · isfolder · ispref · ls · matlabroot · memmapfile · mkdir · movefile · open · path · pathsep · pcode · pwd · readstruct · rehash · restoredefaultpath · rmdir · rmpath · run · savepath · setenv · setpref · system · tempdir · tempname · uigetdir · uigetfile · uiputfile · unsetenv · userpath · what · winqueryreg · xmlread · xmlwrite
Tabular
arrayDatastore · csvread · csvwrite · detectImportOptions · dlmread · dlmwrite · fileDatastore · parquetDatastore · parquetinfo · parquetread · readcell · readmatrix · readtimetable · spreadsheetImportOptions · writecell · writematrix · writetable · writetimetable · xlsread · xlswrite
Filetext
fclose · feof · fgetl · fgets · fileread · filewrite · fopen · fprintf · fread · frewind · fwrite · readlines · writelines
Import
Json
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how opentoline is executed, line by line, in Rust.
- View the source for opentoline in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.