-
Notifications
You must be signed in to change notification settings - Fork 66
Description
there are some confusion about column ':' here to the converter. But it's not the converter's fault. I would say it's the lousy way or style people write Matlab script.
For example, sometimes people write Matlab in this way:
a = ones(5,1);
b = a(:);
Since a is column vector, there is no need to write b = a(:), it can be just b = a;
Although Matlab doesn't care the difference, m2cpp could get confused.
The generated C++ code for b = a(:) is
b = a(span(0, a.n_cols-1)) ;
which is assigning b = a(0), since a.n_cols = 1.
I am not sure if there is a way to make m2cpp smart enough to be aware of this. But there are some people just writing bad Matlab code.
I will summarize some bad Matlab coding styles that confuse m2cpp and people who use m2cpp should avoid using them later in next report.