Dissect a String and create list with Matlab

Hello !
I come from Python and i would like, with Matlab, to dissect a string and keep each part in a List. Like that :
A = "black || white || pink || yellow"
and so i would like to have
B = ["black", "white", "pink", "yellow"]
Thanks for helping !

 Akzeptierte Antwort

Jos (10584)
Jos (10584) am 2 Mai 2019

0 Stimmen

A = "black || white || pink || yellow"
B = split(erase(A,'|')).'

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by