您可以通过为输出结构动态生成字段名称来做到这一点。
% Example input
MyStruct = struct('your_firstfield', 1, 'your_secondfield', 2, 'your_thirdfield', 3 );
% Get a cell array of MyStruct's field names
fields = fieldnames(MyStruct);
% Create an empty struct
temp = struct;
% Loop through and assign each field of new struct after doing string
% replacement. You may need more complicated (regexp) string replacement
% if field names are not simple prefixes
for ii = 1 : length(fields)
temp.(strrep(fields{ii}, 'your', 'my')) = MyStruct.(fields{ii});
end
% Replace original struct
MyStruct = temp;