From: Matt Fig on 6 Aug 2010 18:05 You might have a look at the STRREP function.
From: Walter Roberson on 6 Aug 2010 18:20 Aino wrote: > a quick question. I would like to remove the dot in the decimal number > in order to include it to a file name. So if d=0.1;, num2str(d) will > convert it to string, but is there something simple to get d to '01' > (such as nonzero is for zeros)? If you have a single decimal point, multiply by 10 before taking num2str(). In general if you have a string S that contains a '.' that you want to remove, S(S=='.') = [];
From: Aino on 6 Aug 2010 19:37 Walter Roberson <roberson(a)hushmail.com> wrote in message <i3i1rc$ol4$2(a)canopus.cc.umanitoba.ca>... > Aino wrote: > > > a quick question. I would like to remove the dot in the decimal number > > in order to include it to a file name. So if d=0.1;, num2str(d) will > > convert it to string, but is there something simple to get d to '01' > > (such as nonzero is for zeros)? > > If you have a single decimal point, multiply by 10 before taking num2str(). > > In general if you have a string S that contains a '.' that you want to remove, > > S(S=='.') = []; Thank you all, short and neat. :) -Aino
|
Pages: 1 Prev: Removing a dot from decimal numbers Next: how can I see my old watch list |