Freezing after calling strcat()

str1 = ["John ","Mary "];
str2 = ["Smith","Jones"];
str = strcat(str1,str2)
The code above is the example code from https://ww2.mathworks.cn/help/matlab/ref/strcat.html
Running this code will cause freezing, as if strcat actually doesn't support strings.

6 Commenti

Stephen23
Stephen23 il 12 Lug 2019
Modificato: Stephen23 il 12 Lug 2019
@Disciple of the Forbidden Spell: what MATLAB version are you using? Please show the output of this command:
which strcat -all
Just to check: what shows up for
which strcat(str1,str2)
>> which strcat -all
C:\Program Files\Polyspace\R2019a\toolbox\matlab\strfun\strcat.p
C:\Program Files\Polyspace\R2019a\toolbox\matlab\strfun\@cell\strcat.p % cell method
C:\Program Files\Polyspace\R2019a\toolbox\matlab\strfun\@cell\strcat.m % cell method
C:\Program Files\Polyspace\R2019a\toolbox\matlab\strfun\@string\strcat.m % string method
C:\Program Files\Polyspace\R2019a\toolbox\matlab\strfun\strcat.m % Shadowed
>> which strcat(str1,str2)
C:\Program Files\Polyspace\R2019a\toolbox\matlab\strfun\@string\strcat.m % string method
str = str1 + str2;
That works. But what's wrong with strcat?
I do not know. Perhaps it is related to Polyspace, but I do not know.

Risposte (0)

Questa domanda è chiusa.

Prodotti

Release

R2019a

Chiuso:

il 20 Ago 2021

Community Treasure Hunt

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

Start Hunting!

Translated by