upper — Convert text to uppercase in MATLAB and RunMat.
upper(text) converts alphabetic characters to uppercase while retaining the input text container and non-alphabetic content.
Syntax
out = upper(str)Inputs
str- Type
Any- Required
- Yes
- Description
- String, character array, or cell array of text scalars.
Returns
out- Type
Any- Description
- Uppercased text preserving the input container and element shape.
Errors
RunMat:upper:InvalidInput- When
- Input is not a string array, character array, or cell array of text scalars.
- Message
upper: first argument must be a string array, character array, or cell array of character vectors
RunMat:upper:CellElement- When
- Cell array contains a non-text element or non-row char array element.
- Message
upper: cell array elements must be string scalars or character vectors
RunMat:upper:InternalError- When
- Internal output container construction failed.
- Message
upper: internal error
Text containers
upper(text) converts alphabetic code points to uppercase. Non-alphabetic characters pass through unchanged; string arrays preserve shape, orientation and missing values.
Character arrays are processed row by row. MATLAB documents Latin-1 character-array case conversion and Unicode string-array conversion. RunMat currently applies Unicode uppercase mappings to character arrays as well; mappings beyond the documented MATLAB character set are not claimed as verified MATLAB parity.
Cell arrays retain their dimensions. Character-vector cells are supported in both compatibility modes; cells containing string scalars are a RunMat-only extension. Numeric, logical, struct and resident numeric inputs are not text.
Execution
upper runs on host text with no provider kernel or fusion path. It does not implicitly convert or gather a numeric GPU handle; convert code points to host text explicitly first.
It reads no workspace or external resources and invokes no callbacks. Malformed input and output construction may throw.
Examples
Convert a string scalar
txt = "RunMat";
result = upper(txt)Expected output:
result = "RUNMAT"Convert a string array
labels = ["north" "South"; "East" "west"];
uppered = upper(labels)Expected output:
uppered = ["NORTH" "SOUTH"; "EAST" "WEST"]Convert character-array rows
animals = char("cat", "doge");
result = upper(animals)Expected output:
result = ['CAT '; 'DOGE']Convert cell text
C = {'hello', 'World'};
out = upper(C)Expected output:
out = {'HELLO', 'WORLD'}Preserve a missing string
vals = ["data" string(missing) "gpu"];
converted = upper(vals)Expected output:
converted = ["DATA" <missing> "GPU"]Gather numeric code points before conversion
codes = gpuArray(uint16('runmat'));
txt = char(gather(codes));
result = upper(txt)Expected output:
result = 'RUNMAT'Using upper with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how upper changes the result.
Run a small upper example, explain the result, then change one input and compare the output.
FAQ
Does upper change non-alphabetic characters?⌄
No. Digits, punctuation, whitespace and symbols remain untouched; alphabetic code points with uppercase mappings change.
What happens to character-array dimensions?⌄
Rows stay rectangular. An uppercase mapping may expand a character, in which case the output gains columns and shorter rows are padded with spaces.
Can numeric arrays be passed to upper?⌄
No. Numeric, logical and struct inputs raise a type error. Convert them to strings or character arrays explicitly first.
How are missing strings handled?⌄
Typed missing string elements remain missing. Literal <missing> text is ordinary text and follows the same case mapping as other text.
Does upper execute on the GPU?⌄
No. There is no resident-text representation or provider string kernel. Numeric GPU handles reject without implicit gathering; gather code points and convert them to text explicitly first.
Related Strings functions
Transform
append · deblank · erase · eraseBetween · erasePunctuation · eraseURLs · extractAfter · extractBefore · extractBetween · insertAfter · insertBefore · join · lower · pad · replace · replaceBetween · reverse · split · splitlines · strcat · strip · strjoin · strjust · strrep · strsplit · strtrim
Text Analytics
addDependencyDetails · addEntityDetails · addLemmaDetails · addPartOfSpeechDetails · addSentenceDetails · addTypeDetails · bagOfNgrams · bagOfWords · cosineSimilarity · doc2sequence · encode · extractFileText · extractHTMLText · fastTextWordEmbedding · findElement · getAttribute · htmlTree · ind2word · isVocabularyWord · normalizeWords · readWordEmbedding · removeLongWords · removeShortWords · removeStopWords · removeWords · stopWords · tokenDetails · tokenizedDocument · trainWordEmbedding · vaderSentimentScores · vec2word · word2ind · word2vec · wordEncoding · writeWordEmbedding
Core
blanks · char · compose · convertCharsToStrings · convertContainedStringsToChars · convertStringsToChars · genvarname · int2str · isletter · isspace · isStringScalar · isstrprop · mat2str · native2unicode · newline · num2str · sprintf · sscanf · str2double · str2num · strcmp · strcmpi · string · string.empty · strings · strlength · strncmp · strncmpi · strtok · unicode2native
Search
contains · endsWith · matches · startsWith · strfind
Pattern
digitsPattern · lettersPattern · pattern · regexpPattern · textBoundary · wildcardPattern
Source you can read
Every RunMat function's source is public. Read exactly how upper is executed, line by line, in Rust.
- View the source for upper in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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.