0
0
MATLABdata~10 mins

String concatenation in MATLAB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to concatenate two strings using the correct operator.

MATLAB
result = [str1 [1] str2];
Drag options to blanks, or click blank then click option'
A+
Bstrcat
C.*
D[]
Attempts:
3 left
💡 Hint
Common Mistakes
Using + operator for string concatenation
Using .* which is for element-wise multiplication
2fill in blank
medium

Complete the code to concatenate strings with a space between them.

MATLAB
result = [str1 [1] str2];
Drag options to blanks, or click blank then click option'
A' '
B+
C,
D;
Attempts:
3 left
💡 Hint
Common Mistakes
Using comma or semicolon which do not concatenate strings
Using plus sign which is invalid for strings
3fill in blank
hard

Fix the error in the code to concatenate strings correctly.

MATLAB
result = strcat(str1, [1], str2);
Drag options to blanks, or click blank then click option'
A,
B' '
C+
D;
Attempts:
3 left
💡 Hint
Common Mistakes
Using comma or semicolon which are not valid string arguments
Using plus sign which is invalid in this context
4fill in blank
hard

Fill both blanks to create a string array concatenating str1 and str2 with a space.

MATLAB
result = [[1] [2] str2];
Drag options to blanks, or click blank then click option'
Astr1
B' '
C+
D;
Attempts:
3 left
💡 Hint
Common Mistakes
Using + operator which is invalid for string concatenation in MATLAB
Using semicolon which separates rows, not concatenates horizontally
5fill in blank
hard

Fill all three blanks to concatenate str1, a comma, and str2.

MATLAB
result = [[1] [2] [3]];
Drag options to blanks, or click blank then click option'
Astr1
B','
C' '
Dstr2
Attempts:
3 left
💡 Hint
Common Mistakes
Using plus signs for concatenation
Forgetting to put the comma in quotes