switch the case of letters so that 'hello' becomes 'hello' in matlab

In Matlab, we can convert the case of a string using the upper and lower functions. However, if we want to keep the case of the string unchanged, we can simply copy the string to a new variable. Here's an example:

main.m
str = 'hello';    % original string
new_str = str;    % create a copy of the original string
93 chars
3 lines

The new_str variable now contains the same string as str. We can verify this by comparing the two strings:

main.m
isequal(str, new_str)
22 chars
2 lines

The output of this command should be true.

related categories

gistlibby LogSnag