我想替换结构数组中的字段的值.例如,我想在以下结构中将所有1替换为3.
a(1).b = 1;
a(2).b = 2;
a(3).b = 1;
a([a.b] == 1).b = 3; % This doesn't work and spits out:
% "Insufficient outputs from right hand side to satisfy comma separated
% list expansion on left hand side. Missing [] are the most likely cause."
Run Code Online (Sandbox Code Playgroud)
这有一个简单的语法吗?我想为这种简单的操作避免丑陋的循环.
matlab ×1