5 views (last 30 days)
I wonder wether Matlab could include a form of arithmetic operations common in C, namely x+=y, x*=y, x/=y etc.
In the piece of code
ctrl = somevar <= someother;
x(ctrl) = -x(ctrl);
indexing takes place twice, while x(ctrl)*= -1; could possibly save some time, unless the optimization of the Matlab interpreter makes this idea obsolete.
Anybody has an answer? Thanks
Aiswarya Subramanian on 5 Jul 2019
Such operations are not supported by MATLAB. You can go through the post 11 ( Steven Lord's answer ) I have attached below, which says that since MATLAB is array based, such operator would be ambiguous and unintuitive.
Hope it helps :)