How to change the type of waves (e.g., text wave --> number wave)
shen2
I am wondering how I can change or convert text waves to number waves (or the opposite way).
The other related problem is: When I enter dates into a column, the column sometimes is recognized as a text wave, but sometimes as a number wave. Why?
Thanks!
Make /D /N=3 numericWave = str2num(textWave)
Edit textWave, numericWave
If your text wave contains dates then it is a lot more complicated and depends on the format of the dates. Post an example of the text wave contents.
To see the format that Igor expects dates to be in and to change it, choose Table->Table Date Format.
If the text you are pasting does not match the table date format then the table will create a text wave. It also will create a text wave if there are unexpected characters in the pasted text, for example, extraneous spaces or tabs.
If this does not solve the problem then tell me exactly what text you are pasting that creates a text wave.
November 28, 2012 at 09:41 pm - Permalink
When you copy and paste from excel you copy what is displayed in the cells. Unless you are displaying the entire number to 15dp you may be truncating the precision of the number.
I always change the formatting of the cell to number, and displaying 15dp. This may also be why some cells are copying as text and some as numbers (the cell may be formatted as text).
November 28, 2012 at 09:58 pm - Permalink
One more question about the labeling on y-axis. Attached is an example, in which the y-axis is date and formatted as MM/DD/YY. How can I change that to the following format:
1). MM/YY (e.g., 1/2010, 7/2010, 1/2011, 7/2011, etc.)
or
2). Jan. 2010, Jul. 2010, Jan. 2010, etc.
I tried some changes in the "Auto/Man Ticks", but I was not allowed to change the date format in "Canonic tick, which shows "01/'01/1904".
Thanks!
November 29, 2012 at 06:33 am - Permalink
For details execute this:
and read that section and the next section, "Custom Date Formats".
November 29, 2012 at 08:43 am - Permalink
November 29, 2012 at 10:19 am - Permalink
If I use explicit names then things work as described in the earlier post above eg.
Make /D /N =(eventsLen) FFTnumb = str2num(FFTnum)
where eventlen is a variable FFTnumb is to be the new wave and FFTnum is the original one
I have old and new names that have been generated in do loop
j = 0
do
newName = prefix2 + num2str(j)
oldname = prefix1 +num2str(j)
Make /D /N =(eventsLen) $newName = str2num($oldName)
j+=1
while (j <= 99)
where prefix1 and prefix2 are strings
Thnaks
July 17, 2016 at 09:19 am - Permalink
Looking at your code, I think the problem is that you need to declare the Wave. At the moment you are making a wave where every point is the value of the the wavename being converted to a number.
Try:
do
newName = prefix2 + num2str(j)
oldname = prefix1 +num2str(j)
Wave/z oldWave = $oldName
Make /D /N=(eventsLen) $newName = str2num(oldWave)
j+=1
while (j <= 99)
Presumably you specify prefix1, prefix2 and eventslen somewhere else.
July 17, 2016 at 01:28 pm - Permalink
July 18, 2016 at 08:08 am - Permalink