A problem from beginner
llzy36
Function fSave_data_old_format(Data_date, n_start, n_stop)
string Data_date, n_start, n_stop
variable n=str2num(n_start), lim=str2num(n_stop)+1
string aa, bb
variable n1, lim1, t1, t2, tt, k, n2, lim2, n3, lim3=numpnts(time_s), n4, lim4
variable Seg_len=dimsize(data_ch0,1), Tot_part=dimsize(data_ch0,0), n5, n6, Particle_counter
do
if (n < 10)
bb = "00" + num2str(n)
else
if (n < 100)
bb = "0" + num2str(n)
else
bb = num2str(n)
endif
endif
aa = "SP2_"+Data_date+"x"+bb
SetDataFolder root:$aa
wave data_ch0, data_ch1, data_ch2, data_ch3, TimeWave
Seg_len = dimsize(data_ch0,1)
Tot_part = dimsize(data_ch0,0)
make/o/n=(Seg_len*Tot_part)/d Ch0, Ch1, Ch2, Ch3
n6 = 0
do // making 1-d data out of 2-d data
n5 = 0
do
if (data_ch0[n6][n5] < 2046)
ch0[n6*Seg_len+n5] = data_ch0[n6][n5]
else
ch0[n6*Seg_len+n5] = nan // remove saturated part of the scattering signal
endif
ch1[n6*Seg_len+n5] = data_ch1[n6][n5]
ch2[n6*Seg_len+n5] = data_ch2[n6][n5]
ch3[n6*Seg_len+n5] = data_ch3[n6][n5]
n5 += 1
while (n5 < Seg_len)
n6 += 1
while (n6 < Tot_part)
Pathinfo home
bb = s_path + aa
NewPath/C/O/Q/Z Path1, bb
Save/C/O/P=Path1 Ch0 as "Ch0.ibw"
Save/C/O/P=Path1 Ch1 as "Ch1.ibw"
Save/C/O/P=Path1 Ch2 as "Ch2.ibw"
Save/C/O/P=Path1 Ch3 as "Ch3.ibw"
Save/C/O/P=Path1 TimeWave as "TimeWave.ibw"
killwaves Ch0, Ch1, Ch2, Ch3
n += 1
while (n < lim)
end
into the command line.
I haven't look though the code in detail, but be aware that you need a certain datafolder which will define what "Data_date" is. And there need to be certain waves present.
September 27, 2012 at 03:30 am - Permalink
Make/N=(10,4) '2DWave'=p+10*q
This command fills the wave with values that are easily distinguished. I usually make a copy of my data before manipulating it, just so I don't destroy anything. You can do that from a dialog, using Data->Duplicate Waves menu item. That will generate a command something like this:
Duplicate '2DWave', '1DWave'
Note that '1DWave' is still two-dimensional. Now this command will convert it to a one-dimensional wave, while preserving all the data:
Redimension/N=40 '1DWave'
The key here is that N=40 is the same number of points as N=(10,4). In that case, Igor will rearrange the data (actually, the data are laid out in memory the same way, Igor just changes its interpretation of the arrangement).
Note that I have had the bad taste to use "liberal" names (the initial digit makes them liberal names) and had to enclose the wave names in single quotes.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 27, 2012 at 09:20 am - Permalink