Continuous aquisition​of multiple channels to output file
i am using the DAQ PCI 6254 along with the SCB-68. i am trying to sample 9 different voltages. i want to be able to start the acqisition and then have it run until i stop it a few minutes later with a button or switch because i dont know how long i will need to aquire. after it is stopped, i want to be able to save this to a .txt file. i have tried using different loops but i can not get all the data into the file. i am new to labveiw so i sure there is a simple way to do this. any help would be great. thanks
When are you sampling do you want to save the values in a tabulated form?
How do want to save it?
If your measuraments are real numbers you could use the VI Format into file along with the VI open file and closed file with a for or while loop to save in a tabulated form.
For DAQ using SCB68 check the examples since there are some that show how to acquire voltage measuraments. You only have to add the saving part.
I have a VI to give you an idea.
Attachments:
Temperature logger.vi 51 KB
Similar Messages
-
Multiple channel waveform output using a 6711 board
Hi,
I am writing a driver for VxWorks RTOS based on the DDK for a NI6711
analog output board. I cannot find an example for timed waveform
output on more than one channel. I adopted aoex3.cpp (which works
fine under VxWorks for one channel) to operate also multiple channels.
I set all DACs to timed and wrote to the waveform generation register
once for each channel. I tried several settings for the number
of channels:
theSTC->AO_Mode_1.writeAO_Multiple_Channels(1);
theSTC->AO_Output_Control.writeAO_Number_Of_Channels(iNumChans);
None of the settings of iNumChans results in the correct output on all selected channels.
The comedi driver uses the settings
theSTC->AO_Mode_1.writeAO_Multiple_Channels(0);
theSTC->AO_Output_Control.writeAO_Number_Of_Channels(0); But that does not work either
Any help would be very much appreciated.
Heike
Attachments:
aoex7.cpp 20 KBSoory , here is the attached example
Attachments:
aoex7.cpp 20 KB -
Continuous DAQ with multiple Channels using 6023E
I am trying to countinuously aquire data from 8 channels using a 6023E (without loosing data). For some reason it allways gives me error -10092. Meaning the card requires a certain time between each scan.
If i set the scan rate to something that works, I loose
data. Does anyone know how to do this right without loosing data whilst using double buffering or is this
not possible?
ThanksOk I got somehow further.
My problem was understanding the relationship between sampling rate and scanning rate.
with E series the sampling rate is not the max sampling rate for a given channel but the overall sampling rate for A/D conversion. Further more
in order to avoid error -10092 you have to set the
scan rate to be slower than the sample rate:
One way is scanrate=samplerate/(NumberofChannelsUsed+1)
why this is necessary, i dont know?
so if you get 2 channels rate divisor 1,2 yields
SampleRate Channel1= scanrate/1
SampleRate Channel1= scanrate/2
ie. samplerate=100000 (10kHz)
3 channelsUsed -> ScanRate=25000 (25kHz)
divisors for each channel 1,2,1
means
channel1 samplerate=25 kHz
channel2 samplerate=12,5 kHz
channel3 samplerate=25 kHz
w
ith this i get a what looks like a seamless aquisition from Halfbuffer to Halfbuffer.
But I am not sure if all i mentioned is correct? -
Steps to create a VI to read multiple channels
This is the first time I've used LabView. I want to create a VI to be able to read viltages from multiple channels and output the value of each channel to individual numeric indicators in the VI. I know how to read a single channel and I've created a task in DAQmax with multiple channels but how would I put that into a VI that will do what I need.
Thanks,
AlbertAssuming you are using the DAQ Assistant and getting one sample per scan, then you just use the Split Signal and wire the outputs to your indicators.
Message Edited by Dennis Knutson on 04-30-2007 09:49 PM
Attachments:
Split Signals.PNG 4 KB -
Multiple channel sampling and write file
Hei,
I wrote a interface which is supposed to allow me to plot multiple channel and write all those datas in a file ; The problem is that :
1- not all the curves are plot in my graph (in fact just one is ploted).
2- At the same time it write in a file but after some times it stoped due to an error : buffer size...related to the offset.
I have attached the vi, I don't understand exactly where those problems are comming from and how to solve them easily.
Thanks for the help
P.
Attachments:
project.vi 207 KBHi thanks those tips. In fact I had solved those problems mentionned above ; I have alomst finish my interface except that I am trying to write all my datas in a file , in column (all channels) and create a first column at the time (maybe from the sampling time). The problem is that I don't know the output fomat of the "analog 2D DBL" vi and it seems that my way of writing datas time step per time are not right. have you already see this kind of used (analog 2D DBL)? I am using a PCI-6229, and DAQmx 7.3 Drivers
Thanks for your help
P.
Attachments:
project_acquisition.vi 338 KB -
Read multiple files and save all into one output file(AGAIN)
Hi, guys
I need your help for reading data from multiple files and save the results into one output file. When files are selected from file chooser, my program read the data line by line , do some calculations and save the result into the output. I made an array to store input files and it seems to be working fine, but when it comes to SaveFile() function, issues NullPointException message.
public class FileReduction1 extends JFrame implements ActionListener
// GUI definition and layout
/* ACTION PERFORMED */
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand().equals("Open File")) getFileName();
/* OPEN THE FILE */
private void getFileName() {
// Display file dialog so user can select file to open
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(true);
int result = fileChooser.showOpenDialog(this);
// If cancel button selected return
if (result == JFileChooser.CANCEL_OPTION) return;
if (result == JFileChooser.APPROVE_OPTION)
files = fileChooser.getSelectedFiles();
textArea.setText("");
if(files.length>0)
filelist="";
System.out.println("files length"+files.length);
for(int i=0;i<files.length;i++)
System.out.println(files.getName());
filelist+=files[i].getName()+" ,";
if (checkFileName(files[i]) )
openButton.setEnabled(true);
readButton.setEnabled(true);
textArea.append("file "+files[i].getName()+"is a proper file"+"\n");
readFile(files[i]);
textfield.setText(filelist);
else{JOptionPane.showMessageDialog(this,"Please select file(s)",
"Error 5: ",JOptionPane.ERROR_MESSAGE); }
// Obtain selected file
/* READ FILE */
private void readFile(File fileName_in) {
// Disable read button
readButton.setEnabled(false);
// Dimension data structure
getNumberOfLines(fileName_in);
data = new String[numLines][4];
// Read file
readTheFile(fileName_in);
// Rnable open button
openButton.setEnabled(true);
/* GET NUMBER OF LINES */
/* Get number of lines in file and prepare data structure. */
private void getNumberOfLines(File fileName_in) {
int counter = 0;
// Open the file
openFile(fileName_in);
// Loop through file incrementing counter
try {
String line = fileInput.readLine();
while (line != null) {
counter++;
System.out.println("(" + counter + ") " + line);
line = fileInput.readLine();
numLines = counter;
closeFile(fileName_in);
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error reading File",
"Error 5: ",JOptionPane.ERROR_MESSAGE);
closeFile(fileName_in);
System.exit(1);
/* READ FILE */
private void readTheFile(File fileName_in)
// Open the file
//int row=0;
int col=0;
openFile(fileName_in);
System.out.println("Read the file");
// Loop through file incrementing counter
try
String line = fileInput.readLine();
while (line != null)
boolean containsDoubles = false;
double temp;
String[] lineParts = line.split("\t");
try
for (col=0;col<lineParts.length;col++)
temp=Double.parseDouble(lineParts[col]);
data[row][col] = lineParts[col];
containsDoubles = true;
System.out.print("data["+row+"]["+col+"]="+lineParts[col]+" ");
} catch (Exception e) {row=0; col=0; temp=0.0;}
if (containsDoubles){ row++;}
System.out.println();
line = fileInput.readLine();
catch(IOException ioException)
JOptionPane.showMessageDialog(this,"Error reading File", "Error 5: ",JOptionPane.ERROR_MESSAGE);
closeFile(fileName_in);
System.exit(1);
//System.out.println("length"+data.length);
closeFile(fileName_in);
process(fileName_in);
/* CHECK FILE NAME */
/* Return flase if selected file is a directory, access is denied or is
not a file name. */
private boolean checkFileName(File fileName_in) {
if (fileName_in.exists()) {
if (fileName_in.canRead()) {
if (fileName_in.isFile()) return(true);
else JOptionPane.showMessageDialog(null,
"ERROR 3: File is a directory");
else JOptionPane.showMessageDialog(null,
"ERROR 2: Access denied");
else JOptionPane.showMessageDialog(null,
"ERROR 1: No such file!");
// Return
return(false);
/* OPEN FILE */
private void openFile(File fileName_in) {
try {
// Open file
FileReader file = new FileReader(fileName_in);
fileInput = new BufferedReader(file);
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Opening File",
"Error 4: ",JOptionPane.ERROR_MESSAGE);
textArea.append("OPEN FILE\n---------\n");
textArea.append(fileName_in.getPath());
textArea.append("\n");
//System.out.println("File opened successfully");
/* CLOSE FILE */
private void closeFile(File fileName_in) {
if (fileInput != null) {
try {
fileInput.close();
catch (IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Opening File",
"Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File closed");
private void process(File fileName_in) {
//getNumberOfLines();
//data = new String[numLines][3];
// Read file
double temp,temp1;
//readTheFile();
//System.out.println("row:"+row);
//int number=data.length;
//System.out.println(number);
for (int i=0; i<row; i++)
temp=Double.parseDouble(data[i][1]);
sumx+=temp;
temp1=Double.parseDouble(data[i][3]);
sumy+=temp1;
multixy+=(temp*temp1);
square_x_sum+=(temp*temp);
square_y_sum+=(temp1*temp1);
//System.out.println("Sum(x)="+sumx);
double tempup=(row*multixy)-(sumx*sumy);
double tempdown=(row*square_x_sum)-(sumx*sumx);
slope=tempup/tempdown;
double tempbup=sumy-(slope*sumx);
intb=tempbup/row;
double tempside=(row*square_y_sum)-(sumy*sumy);
double cordown=Math.sqrt(tempdown*tempside);
corr=tempup/cordown;
r_sqrt=corr*corr;
textArea.append("Data for file"+ fileName_in.getName()+" have been processed successfully.");
textArea.append("\n");
textArea.append("Please enter output file name including extension.");
System.out.println("number"+row);
System.out.println("slope(m)="+slope);
System.out.println("intecept b="+intb);
System.out.println("correlation="+corr);
System.out.println("correlation="+r_sqrt);
saveFile();
private void saveFile()
textArea.append("SAVE FILE\n---------\n");
if (openFile1())
try {
outputToFile();
catch (IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Writing to File",
"Error",JOptionPane.ERROR_MESSAGE);
private boolean openFile1 ()
// search for the file path
StringBuffer stringpath;
title=textfield1.getText().trim();
int temp=fileName_in.getName().length();
int temp_path=fileName_in.getPath().length();
int startd=(temp_path-temp);
stringpath=new StringBuffer(fileName_in.getPath());
stringpath.delete(startd, temp_path+1);
//System.out.println("file-path="+temp_path);
//System.out.println("length-file="+temp);
path=stringpath.toString();
fileName_out = new File(path, title);
//System.out.println(file_out.getName());
if (fileName_out==null || fileName_out.getName().equals(""))
JOptionPane.showMessageDialog(this,"Invalid File name",
"Invalid File name",JOptionPane.ERROR_MESSAGE);
return(false);
else
try
boolean created = fileName_out.createNewFile();
if(created)
fileOutput = new PrintWriter(new FileWriter(fileName_out));
fileOutput.println("File Name"+"\t"+"Slope(m)"+"\t"+"y-intercept(b)"+"\t"+"Coefficient(r)"+"\t"+"Correlation(R-Squared)");
return(true);
else
fileOutput = new PrintWriter(new FileWriter(fileName_out,true));
return(true);
catch (IOException exc)
JOptionPane.showMessageDialog(this,"Please enter the file name","Error",JOptionPane.ERROR_MESSAGE);
return(false);
private void outputToFile() throws IOException
// Initial output
textArea.append("File name = " + fileName_out + "\n");
// Test if data exists
if (data != null)
fileOutput.println(fileName_in.getName() +"\t"+ slope+"\t"+intb+"\t"+corr+"\t"+r_sqrt);
textArea.append("File output complete\n\n");
else
textArea.append("No data\n\n");
// End by closing file
initialcomp();
fileOutput.close();
private void initialcomp()
slope=0.0;
intb=0.0;
corr=0.0;
r_sqrt=0.0;
sumx=0.0; sumy=0.0; multixy=0.0; square_x_sum=0.0; square_y_sum=0.0;
for(int i=0;i<data.length;i++)
for(int j=0;j<data[i].length;j++)
data[i][j]=null;
/* MAIN METHOD */
public static void main(String[] args) throws IOException
// Create instance of class FileChooser
FileReduction1 newFile = new FileReduction1("File Reduction Program");
// Make window vissible
newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
newFile.setSize(500,400);
newFile.setVisible(true);
Sorry about the long lines.
As you can see, all input files saved in array called files, however when OpenFile1() function is called, it take input (fileName_in) as a single file not an array. I'm assuming this causes the exception.
When there's muptiple inputs, program should take each file from getFileName() to outputToFile() sequentially.
Does anybody have an idea to solve this?
Thanks a lot!!you naming convention is confussing. you should follows Java naming convention..you have a getXXX but decalred the return type as "void"...get usully means to return something...
your code is doing too much..and hard to follows..
1. get the selected files
for each selected file
process the file and return the result
write out the result.
/** close the precious resource */
public void closeResource(Reader in){
if (in != null){
try{ in.close(); }
catch (Exception e){}
/** get the total number of line in a file */
public int getLineCount(File file) throws IOException{
BufferedReader in = null;
int lineCount = 0;
try{
in = new BufferedReader(new FileReader(file));
while ((in.readLine() != null)
lineCount++;
return lineCount;
finally{ closeResource (in); }
/** read the file */
public void processFile(File inFile, File outFile) throws IOException{
BufferedReader in = null;
StringBuffer result = new StringBuffer();
try{
in = new BufferedReader(new FileReader(inFile));
String line = null;
while ((in.readLine() != null){
.. do something with the line
result.append(....);
writeToFile(outFile, result.toString());
finally{ closeResource (in); }
public void writeToFile(File outFile, String result) throws IOException{
PrintWriter out = null;
try{
out = new PrintWriter(new FileWriter(outFile, true)); // true for appending to the end of the file
out.println(result);
finally{ if (out != null){ try{ out.close(); } catch (Exception e){} } }
} -
How to create multiple output files using TrAX?
I am new in this field. I'm trying to create multiple xml output files using TrAX. I have to parse a xml source file and output it to multiple xml files. My problem is that it only creates one output file and puts all the parsed data there. When i use saxon and run xsl and xml files, it works fine and creates multiple files...it has something to do with my java code...Any help is greatly appreciated.
Here's my XSL file
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
<xsl:template match="data_order">
<data_order>
<xsl:copy-of select="contact_address"/>
<xsl:copy-of select="shipping_address"/>
<xsl:apply-templates select="ds"/>
</data_order>
</xsl:template>
<xsl:template match="ds">
<xsl:variable name="file" select="concat('order', position(),'.xml')"/>
<order number="{position()}" href="{$file}"/>
<xsl:document href="{$file}">
<xsl:copy-of select="."/>
</xsl:document>
</xsl:template>
</xsl:stylesheet>
xml source file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE operation SYSTEM 'data_order.dtd'>
<data_order job_id='00-00-000' origin='PM-ESIP'>
<contact_address>
<first_name>ssssss</first_name>
<last_name>sssss></last_name>
<phone>2323232</phone>
<email>dfdfdsaf</email>
</contact_address>
<ds ds_short_name ='mif13tbs'>
<output>
<media_format>neither</media_format>
<media_type>FTP</media_type>
<output_format>GIF</output_format>
</output>
</ds>
<ds ds_short_name ='mif15tbs'>
<output>
<media_format>neither</media_format>
<media_type>FTP</media_type>
<output_format>GIF</output_format>
</output>
</ds>
</data_order>
My java file
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.io.*;
public class FileTransform {
public static void main(String[] args)
throws Exception {
File source = new File(args[0]);
File style = new File(args[1]);
File out = new File(args[2]);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer t = factory.newTransformer(new StreamSource(style));
t.transform(new StreamSource(source), new StreamResult(out));Saxon has specific extensions. In this case it is <xsl:document>. That looks like a standard XSLT element, but it actually isn't. The history behind it is this: There was a proposal to create a new version of XSLT, called XSLT 1.1. One of the new features of this version was to be this xsl:document element. The author of the Saxon product, Michael Kay, is one of the people on the W3C committee directing the evolution of XSLT, so he upgraded his product to implement XSLT 1.1. But then the committee decided to drop XSLT 1.1 as a recommendation. So that left Saxon in the strange position of implementing a non-existent extension to XSLT.
The other outcome of this process was that XSLT (1.0) does not have a way of producing more than one output file from an input file. And so the short answer to your question is "Trax can't do that." However, XSLT 2.0 will be able to do that, although it is not yet a formal W3C recommendation, and when it does become one it will take a while before there are good implementations of it. (I predict that Saxon will be the first good implementation.)
One of the problems with XML and XSLT is that what you knew a year ago is probably obsolete now, because of all the evolution going on. So being new in the field is not a disadvantage, unless you get stung by reading obsolete tutorials or magazine articles. -
Get MUTLIPLE output files for SINGLE input file with multiple records
Hi ,
I have source xml file which has multiple records in it and I want to get multiple seperate flat files for it.
this is my source structure
<root>
<Header1 fld1=1234 fld2="name1" fld3='SAP1"
fld4='000" fld5=0 fld6="sdn1"></header>...............no line items here
<Header2 fld1=123 fld2="name" fld3='SAP"
fld4='00" fld5=0 fld6="sdn" ><line fld7=value1 fld8=value2 fld9=value3 /line><line fld7=value4 fld8=value5 fld9=value6 /line></header>.....two line items here
<Header3 fld1=123 fld2="name" fld3='SAP"
fld4='00" fld5=0 fld6="sdn" ><line fld7=value7 fld8=value8 fld9=value9 /line></header>......one line item here
Header4 fld1=12345 fld2="name2" fld3='SAP2"
fld4='0006" fld5=01 fld6="sdn2"</header>.......no line items here
</root>
I am trying to get flat files as many time the <b>header</b> values occur that many target files should appear in the target.
like
file1:
1234name1SAP10000~sdn1
file2:
123nameSAp000~sdn
value1value2valu3
valu4value5value6
file3:
123namesap000~sdn
value7valu8value9
file4:
12345name2SAP2000601~SDN2
here I have 4 headers so i need to get 4 output files ,similarly for 'n' headers I need to get 'n' output flat files. the above mentioned source xml file is just one file,like that I might get somany sourc xml files which has similar structure in it.
and also it is important to get the line items,if exists to the header, for the corresponding headers.
how can I achieve this?do I need to use BPM or any mappings other than Graphical?
please suggest me.
thank you.
Babu
sorry,output file structure changed
BabuBabu,
See the Mapping and the logic.
Make sure your target message occurrence:http://www.flickr.com/photo_zoom.gne?id=1412748793&size=o
Check out for source and target structure
http://www.flickr.com/photo_zoom.gne?id=1412748803&size=o
http://www.flickr.com/photo_zoom.gne?id=1412748809&size=o
http://www.flickr.com/photo_zoom.gne?id=1412748815&size=o
http://www.flickr.com/photo_zoom.gne?id=1412748825&size=o
Results:http://www.flickr.com/photo_zoom.gne?id=1412748799&size=o
Note:
While creating Interface determination choose it as Enhanced/Extended
The Receiver Content conversion - For field separator and line separator give 'nl' , coz we concatenated all of them using ~ in mapping.
If you find any discrepancy in the above logic , please let me know.
raj. -
How to get multiple html output file from an xml document via xslt?
Hi,
the purpose is to generate multiple html output file from one xml file
depending on special tag.
exp: i have an xml file which contains sevreral articles so how to get each article section in an independant html file
Thanks for helpNot a standard feature of XSLT. But Michael Kay's XSLT implementation, SAXON, provides that as an extension. Get it here:
http://saxon.sourceforge.net/ -
How to filter Multiple channels without losing outputs
Hello all, this really is my last hope. I'm having a real big issue in Logic, it's been that way since I started and I'm hoping someone help me. The issue is the same with every track I create, and is as follows:
An example I will use is the main 'drop' of a track. I want to have most elements gradually filtering out, to allow an emphasis when the beat kicks back in at the drop. At the same time, I want to leave some elements playing, such as reverse cymbal, rise/swoosh/sweep sounds etc. The problem I have is how to select multiple items to filter out, using ONE filter (eg. Beats & bass) and not have to put a filter on EVERY individual track and automate them individually.
I know one option would be to send all of these items to a bus, and then filter that bus, but then that means that the elements are playing from TWO sound sources - their original channel strip AND the bus that they are now assigned to.
I know this problem can be alleviated by removing the output from the original channel strips, and only have their sound coming from the BUS, but then this causes the problem of loss of impact/volume because I'm losing the original sound source.
Lots of my sounds are sent together to busses, eg. BeatsBus. BassBus etc. where they all gather and are compressed together creating extra volume and compression effect.
Hopefully I have explained myself well enough here, it's not the easiest problem to articulate over a message.
But to recap, I want to filter multiple sounds (beats, bass and everything else) with one filter, without losing my MULTIPLE sound sources, ie their original channel strip output.
Please please help.
Steven.Dont use a send to get the tracks to the bus. Assign the tracks OUTPUTS (should say "stereo out" before you change it) directly to the busses.
-
Urgent: How to break pdf output file in multiple pdf files without bursting
Hi all,
I am developing a rtf template which will take a xml file which contains data for many employees. Now the requirement is to create a individual pdf file for each user. I know that it can be done through Oracle bi publisher's interface through bursting but we don't have that option. We have to do it at template level.
Right now my template produces report for multiple employees on a new page.
<?for-each-group@section:row;./USERS_SYS_ID?><?split-by-page-break:?>
<?end for-each-group?>
Is there any method like <?split-by-file-break:?> by which each employee report can be started in a new output file.
Thanks and Regards,Thanks, George!
I will try your suggestion.
While waiting for a response, I ran into another problem:
Some of the PDF documents I am to work from are "protected," meaning I can read them but not extract any pages or click to add them to a list of files to import...but I need to extract some or all pages from it. Any suggestions on this?
Thanks! -
Question about creating multiple output files from same query
I have a query like this:
select * from emp;
ename empno deptno
Scott 10001 10
Tiger 10002 10
Hanson 10003 20
Jason 10004 30
I need to create multiple output files in xml format for each dept
example:
emp_dept_10.xml
emp_dept_20.xml
emp_dept_30.xml
each file will have the information for employees in different departmemts.
The reason I need to do this is to avoid executing the same query 200 times for generating the same output for different departments. Please let me know if it is practically possible to do this.
Any input is greatly appreciated.
Thanks a lot!!You can write a shell script to generate the multiple spools files for the same output. Below script may helps you.
#====================
#!/bin/bash
n=0
while [ $n -le 20 ]
do
n=`expr $n + 1`
sqlplus -s system/manager <<EOF
spool emp_dept_$n.xml
select count(1) from tab;
spool off
EOF
done
#==================== -
Multiple output files from single Request
Hi guys
i have one requirment,can we display multiple outputs files (multiple templates) for a single request .
ie i have some banks ,if i run an request ,it will get the details of each bank details ,induadual template .
let me know the solution for this one.
thanks inadvance.Pl post details of OS, database and EBS versions.
Pl elaborate on your requirements. Assuming you are using XML/BI Publisher, the physical output file will be a single file, but you can use XML/BI Publisher bursting features to separate out different outputs.
How to Implement XML Publisher Bursting in 11.5.10.2? (Doc ID 740428.1)
How to Print Via Bursting Control File (Doc ID 844276.1)
HTH
Srini -
Script to auto zero channels in a TDM file with multiple channel groups
Hi friends,
I am trying to process some data but am having trouble modifying a script to autozero channels across multiple channel groups. The following script works to zero channels across one group. I use this script to process data in a TDM file with only one channel group. I need to be able to zero channels across multiple groups (5 groups). But the amount of groups I will have may change so I might need an option to enter the amount of groups or have the script determine the amount of groups in my TDM file.
Here is the code I use to zero the data. Thanks in advance for your help!
Sub UserDlg_Select
Call USERDLGINIT()
USERDLGCAPTION="Auto Zero Channel Based on Specified Points "
USERDLGTXT(5)="Number of points to Average"
USERDLGCOMMAND(5)="t1"
Call USERDLGOPEN()
End Sub
Call UserDlg_Select()
T2="1-"&T1
For I= 1 To ChnNoMax 'For all data channels except time
T4=CHNNAME(I) 'Create string for Channel name (I)
T3=ChnDim(T4) 'Create text variable for channel dimension
STATSEL(6)="Yes" 'Arith mean
STATCLIPCOPY="yes"
STATCLIPVALUE="No"
Call StatBlockCalc("Channel",T2,T4) 'Calculate Stats for Channel (I)
'Subtract Mean of first (T1) points for Channel (I)
Call FormulaCalc("Ch('temp1') := CH('"&T4&"') - statarithmean")
CHNCOMMENT("temp1")=("Channel zeroed over first "&T1)+"pts" 'Add Comment
ChnDim("temp1")=T3 'Add Dimension
CHNNAME("temp1")=T4+"-Z" 'Save updated data with -Z
'Delete Stat Channels
Call CHNDEL("ArithmeticMean")
Call CHNDEL("Sum")
Next 'End For loop
Hi rvillalta319,
Sounds like you'll need to adapt your code to use both a for loop and some implementation of the GroupCount variable (or ChannelGroups.Count) as seen here:
http://zone.ni.com/reference/en-XX/help/370858K-01/varoff/groupcount/
-
Add Data Channel Headings to Output File
I have seen several threads discussing how to get names on the column headers when outputting dynamic data to a file and thought I would give a simple example of how to do this.
The example generates a Y=2X as 2 data flows and sends them to an X-Y graph and a text output file.
It is necessary to convert the dynamic data to a waveform and use the waveform attribute VI to add the attribute named NI_ChannelName.
The waveform is then converted back to dynamic data.
This is the solution I worked out and would appreciate confirmation from more expert users if this is the best way.
Colin
Solved!
Go to Solution.
Attachments:
File Output Test 1.vi 136 KBHi Colin
I've been taking a look at your VI today and just wondered if you could define what you mean by the 'best way'? Do you mean in terms of the speed of running the VI, memory allocation or another factor?
If you could let me know, then I'll look into how best to optimise the VI. Looking forward to hearing back from you,
Best Regards
Jeremy T
Technical Marketing Engineer
National Instruments UK & Ireland
Maybe you are looking for
-
English install of Lion shows lots of options in another language (Spanish?)
I have one of the new 2011 MacBook Airs (with 2 USB ports) and Lion installed. I have done very little to change it from its original setup when I turned it on. It was bought in the UK and everything is shown in English... Except the occasional menu
-
After failing to open it I have uninstalled itunes & tried a new download but it asks to 'verify sufficient privileges to start system service' for mobile device and then fails, what is happening?
-
How to print pallet labels in abap
Can anyody tell me the code for printing a pallet label details from abap editor based on a handling unit and sequence count number?? Thank you
-
Is iphoto part of macbook 2012
my macbook pro has a problem it does not open iphoto after an update why is that
-
I've signed in and out several times