www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/CloneSizeFromExistingStringArrayExample.m
%% Clone String Array Size from Existing Array % Create an array of empty strings that is the same size as an existing % array. A = [1 2 3; 4 5 6]; sz = size(A); str = strings(sz) %% % It is a common pattern to combine the previous two lines of code into a % single line: str = strings(size(A)); %% % You can use |strings| to preallocate the space required for a large % string array.