join 2 strings together to 1
Show older comments
Good Morning all,
i need help manipulating strings.
I know from practically every other program that you can put strings together in one way or another. So very simple, make 1 out of 2.
In Matlab I despair of it.I have a variable 'job' (contains something like: "Biegung_35_") and a string 'Evaluation.txt'. In order to import the content of the txt into matlab either via importfile or readtable, I would like to combine these two strings. I don't mean the kind of assembly that join or cat does, so that I have a 1x2 string array.
It should look like this 'Biegung_35_Evaluation.txt' in a single string.
Please help me
1 Comment
KALYAN ACHARJYA
on 5 Mar 2021
Accepted Answer
More Answers (1)
KSSV
on 5 Mar 2021
Read about join, strcat. You can also achieve the same using:
str = ['Biegung_35_' ,'Evaluation.txt'] ;
1 Comment
Note that the first text sample given in the question is a scalar string, the second text is a character vector.
So using the examples from the question, this answer will coerce the character vector into a scalar string and return a 1x2 string array:
str = ["Biegung_35_" ,'Evaluation.txt']
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!