one two three four
Ältere Kommentare anzeigen
I have two strings stored in a variable
EG
A='HELLO'
B='TEST'
I want to repeat B to make it the same length as A
EG
A='HELLOWORLD'
B='TESTTESTTE'
3 Kommentare
Both A and B have changed length in your example so it's unclear why the final length is 10 characters when they started at 5 and 4 characters. It's also unclear why 'WORLD' has been added to A instead of any other combination of 5 characters.
Guillaume
am 7 Nov. 2019
If Thorsten hadn't posted an answer, I was going to close the question as it's a duplicate of https://www.mathworks.com/matlabcentral/answers/489791-repeat-the-value-of-a-variable-to-match-the-length-of-another-variable
Please don't waste people time by asking the same question twice.
Rena Berman
am 12 Dez. 2019
(Answers Dev) Restored edit
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu String finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!