I would like to change the units of a wave from mV to uV(y value) without changing the x-value. I am currently doing it manually to each wave using wave arithmetic and dividing by a constant but I was wondering if someone could suggest a quicker way since I have to do this on about 90 waves in the same folder, for many folders and it's taking up a lot of time.
This should give you a running start. You need to first get the names of waves in the data folder of interest (code below will work on CURRENT datafolder only). Then, in a for loop, perform the desired operation on each wave.
function ya()
string list = wavelist("*", ";", "")
variablei for(i=0; i<itemsinlist(list); i+=1) wave w = $(stringfromlist(i, list, ";"))
w*=1000//multiply by 1000 for mV to micro-volt conversion endfor end
you can add more code to auto process multiple folders, or, you could have the function accept a string parameter which would be the folder name, just some ideas.
How about using the "Execute Cmd..." button in the data browser?
The command to enter in the dialog box would be "%s /= 1000" (without the quotes), or maybe "%s *= 1000", depending on what is meant by changing the units from mV to uV.
string list = wavelist("*", ";", "")
variable i
for(i=0; i<itemsinlist(list); i+=1)
wave w = $(stringfromlist(i, list, ";"))
w*=1000 //multiply by 1000 for mV to micro-volt conversion
endfor
end
you can add more code to auto process multiple folders, or, you could have the function accept a string parameter which would be the folder name, just some ideas.
June 21, 2013 at 01:28 pm - Permalink
w /= 1000
, eh?John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 21, 2013 at 02:12 pm - Permalink
The command to enter in the dialog box would be "%s /= 1000" (without the quotes), or maybe "%s *= 1000", depending on what is meant by changing the units from mV to uV.
June 22, 2013 at 05:23 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 24, 2013 at 09:50 am - Permalink