how can I trim numbers in matlab (similar to the left and right functions in excel). For example, if: A=[3829 3620 3714] and i want to get the first two digits: to get B=[38 36 37], how can i do so?
The shown code is fast and clear. A reader can recognize, what it should do directly. I hestitate to think, that a correspondingcellfun command would be faster or nicer. So you do not get an advantage for debugging or the runtime. Even if the runtime is a little bit faster, the effort for programming and debugging will exceed this time.
So I'd perfer the "solution" not to care about the "ugliness" of such a useful piece of code. I've seen many code, which are much more ugly.
Best Answer