Zeichen und Zeichenfolgen - MATLAB & Simulink - MathWorks Deutschland (2024)

Text in Character und String Arrays

Character und String Arrays stellen Speicherplatz für Textdaten in MATLAB® bereit.

  • Ein Character Array (Zeichenarray) ist eine Zeichenfolge, genauso wie ein numerisches Array eine Zahlenfolge ist. Es wird typischerweise dazu verwendet, kurze Textbausteine als Zeichenvektoren, wie c = 'Hello World', zu speichern.

  • Ein String Array (Zeichenfolgenarray) ist ein Container für Textbausteine. String Arrays stellen eine Reihe von Funktionen bereit, um mit Texten als Daten zu arbeiten. Sie können Zeichenfolgen mit Anführungszeichen, wie str = "Greetings friend", erstellen. Mit der Funktion string konvertieren Sie Daten in String Arrays.

Weitere Informationen finden Sie unter Text in String and Character Arrays oder sehen Sie sich Verwenden von String Arrays für Textdaten an.

Funktionen

alle erweitern

String Arrays

stringString array
stringsCreate string array with no characters
joinCombine strings
plusAdd numbers, append strings

Character Arrays

charCharacter array
cellstrConvert to cell array of character vectors
blanksCreate character array of blanks
newlineErstellen des Zeichens für eine neue Zeile

Character oder String Arrays

composeFormat data into multiple strings
sprintfFormat data into string or character vector
strcatHorizontales Verknüpfen von Zeichenfolgen
appendCombine strings

Konvertieren von Eingabeargumenten

convertCharsToStringsConvert character arrays to string arrays, leaving other arrays unaltered
convertStringsToCharsConvert string arrays to character arrays, leaving other arrays unaltered
convertContainedStringsToCharsConvert string arrays at any level of cell array or structure

Konvertieren zwischen Zahlen und Zeichenfolgen

doubleArrays mit doppelter Genauigkeit
stringString array
str2doubleConvert strings to double precision values
num2strConvert numbers to character array

Datentyp

ischarDetermine if input is character array
iscellstrDetermine if input is cell array of character vectors
isstringDetermine if input is string array
isStringScalar Determine if input is string array with one element

Texteigenschaften

strlengthLengths of strings
isstrpropDetermine which characters in input strings are of specified category
isletterDetermine which characters are letters
isspaceDetermine which characters are space characters

Suchen

containsDetermine if pattern is in strings
matchesDetermine if pattern matches strings (Seit R2019b)
countCount occurrences of pattern in strings
endsWithDetermine if strings end with pattern
startsWithDetermine if strings start with pattern
strfindFind strings within other strings
sscanfRead formatted data from strings

Ersetzen

replaceFind and replace one or more substrings
replaceBetweenReplace substrings between start and end points
strrepFind and replace substrings

Erstellen von Mustern

patternPatterns to search and match text (Seit R2020b)

Zeichen-Musterabgleich

alphanumericsPatternMatch letter and digit characters (Seit R2020b)
characterListPatternMatch characters from list (Seit R2020b)
digitsPattern Match digit characters (Seit R2020b)
lettersPatternMatch letter characters (Seit R2020b)
whitespacePatternMatch whitespace characters (Seit R2020b)
wildcardPatternMatches as few characters of any type (Seit R2020b)

Muster-Suchregeln

optionalPatternMake pattern optional to match (Seit R2020b)
possessivePatternMatch pattern without backtracking (Seit R2020b)
caseSensitivePatternMatch pattern with case sensitivity (Seit R2020b)
caseInsensitivePatternMatch pattern regardless of case (Seit R2020b)
asFewOfPatternMatch pattern as few times as possible (Seit R2020b)
asManyOfPatternMatch pattern as many times as possible (Seit R2020b)

Grenzwert-Muster

alphanumericBoundaryMatch boundary between alphanumeric and non-alphanumeric characters (Seit R2020b)
digitBoundaryMatch boundary between digit characters and non-digit characters (Seit R2020b)
letterBoundaryMatch boundary between letter characters and non-letter characters (Seit R2020b)
whitespaceBoundaryMatch boundary between whitespace characters and non-whitespace characters (Seit R2020b)
lineBoundaryMatch start or end of line (Seit R2020b)
textBoundaryMatch start or end of text (Seit R2020b)
lookAheadBoundaryMatch boundary before specified pattern (Seit R2020b)
lookBehindBoundaryMatch boundary following specified pattern (Seit R2020b)

Benutzerdefinierte Musteranzeige

maskedPatternPattern with specified display name (Seit R2020b)
namedPatternDesignate named pattern (Seit R2020b)

Reguläre Ausdrücke

regexpMatch regular expression (case sensitive)
regexpiMatch regular expression (case insensitive)
regexprepReplace text using regular expression
regexptranslateTranslate text into regular expression
regexpPatternPattern that matches specified regular expression (Seit R2020b)
joinCombine strings
plusAdd numbers, append strings
splitSplit strings at delimiters
splitlinesSplit strings at newline characters
strjoinJoin strings in array
strsplitSplit string or character vector at specified delimiter
strtokSelected parts of strings
extractExtract substrings from strings (Seit R2020b)
extractAfterExtract substrings after specified positions
extractBeforeExtract substrings before specified positions
extractBetweenExtract substrings between start and end points
eraseDelete substrings within strings
eraseBetweenDelete substrings between start and end points
extractExtract substrings from strings (Seit R2020b)
extractAfterExtract substrings after specified positions
extractBeforeExtract substrings before specified positions
extractBetweenExtract substrings between start and end points
insertAfterInsert strings after specified substrings
insertBeforeInsert strings before specified substrings
padAdd leading or trailing characters to strings
stripRemove leading and trailing characters from strings
lowerConvert strings to lowercase
upperConvert strings to uppercase
reverseReverse order of characters in strings
deblankRemove trailing whitespace from ends of strings
strtrimRemove leading and trailing whitespace from strings
strjustJustify strings
matchesDetermine if pattern matches strings (Seit R2019b)
strcmpCompare strings
strcmpiCompare strings (case insensitive)
strncmpCompare first n characters of strings(case sensitive)
strncmpiCompare first n characters of strings(case insensitive)

Themen

  • Text in String and Character Arrays

    Store and manipulate text using either string arrays or character arrays.

    • Create String Arrays
    • Frequently Asked Questions About String Arrays
    • Update Your Code to Accept Strings
    • Cell Arrays of Character Vectors
  • Analyze Text Data with String Arrays

    This example shows how to analyze text data with stringarrays. It shows how to store, split, and sort text, and how to computeand collect statistics for text in a string array.

    • Compare Text
    • Test for Empty Strings and Missing Values
  • Formatting Text

    Compose character arrays or string arrays that includeordinary text and data formatted to your specification.

  • Search and Replace Text

    MATLAB provides several functions to search for,replace, or extract text in string arrays and character vectors.

    • Build Pattern Expressions
    • Regular Expressions
    • Lookahead Assertions in Regular Expressions
    • Tokens in Regular Expressions
    • Dynamic Regular Expressions
  • Unicode and ASCII Values

    MATLAB stores all characters as Unicode characters. Both strings and character vectors use the same encoding. You can convert characters to their Unicode code values, and numbers to characters.

  • Hexadecimal and Binary Values

    Specify hexadecimal and binary values either as literals or as text. Hexadecimal and binary literals are stored as integers. You can convert text representing hexadecimal and binary values to numbers, and numbers to text representations.

Verwandte Informationen

  • Grundlagen der Programmierung (MathWorks Unterrichtsressourcen)

MATLAB-Befehl

Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:

 

Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.

Zeichen und Zeichenfolgen- MATLAB & Simulink- MathWorks Deutschland (1)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

Zeichen und Zeichenfolgen
- MATLAB & Simulink
- MathWorks Deutschland (2024)
Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated:

Views: 6054

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.