Add the elements of a single row/column of a matrix

Hello everyone,
what's the easiest way to add all the elements of a single row or column of a matrix given the matrix and the number of that row/column on LabVIEW ? The output should be a number for each row or column.
Solved!
Go to Solution.

I'm assuming you are very new to LabVIEW, otherwise you would know about For loops, indexing, and the Array functions.  In many programming languages, a "matrix" is just a multi-dimension array, but in LabVIEW, it is a different representation of a multi-dimension array.
If you are really working with a LabVIEW Matrix, the easiest way might be to convert the matrix to a 2D array and use the various Array functions to do the work.  Note that once you have the row or column isolated as a 1D array, there is a function on the Numeric palette that will add the array elements for you (so you don't need the For loop to do that).
P.S. -- I underlined "might be", above, because I've never actually used LabVIEW's Matrix functions, but have stuck with 2 (or 3, or 4) dimension arrays.
Bob Schor

Similar Messages

  • Add to Selection Fails for Single Row/Column

    Hi,
    Has anyone encountered this. Making additions to selections with the Rectangular and Elliptical Marquee tools works fine. However it fails with both single row and single column marquee tools. This was doable with my previous version of Photoshop but fails on CS4.  I'm running CS4 64 bit on Windows 7.
    Thanks.

    Hi,
    Yes I did
    However this was evidentially some sort of temporary insanity on the part of PS.
    I just a short while ago shut down PS and reopened it and abracadabra the problem disappeared.
    Of course this isn't the first time that shutting down and restarting PS has "fixed" some problem I was having.

  • Single row/column marquee tool "add to" not working

    I was trying to follow along with a tutorial that was using the single row/column marquee tool.  In it they used shift click to add to the selection.  It's not working for me.  I also tried clicking on the add to icon for the marquee tool, and it still doesn't work.  Does anyone know what the problem could be and how I might fix it?
    Thanks!

    hey i know this is late but if its any help now all u need to do i zoom in a lil closer the proceed with the selection. hope i helped. oh and u have to make sure your grid lines are perfectly on the 10,20,30,... percent mark and u have to be zoomed in if u want to see your lines. the problem is your file is too big and has somn to do with ur computer. its not only mac windows too.
    p.s. when ur done drawing the boxes u can zoom out...i know the tutorial

  • How to add an Attachments Table on the Page of a Single Row Region

    Dear All,
    Please help me with a tutorial or anything that help me adding a an Attachments Table on the Page of a Single Row Region.
    I took a look at the attachment in ch4 in the developer guide but it is not explained clearly how to implement it.
    Thanks,
    Mahmoud Assem
    Message was edited by:
    Mahmoud Assem

    If you follow the dev guide properly, there shouldn't be any issue. Let us know where exactly you are facing the issue.
    --Shiv                                                                                                                                                                                                                                                                   

  • How to get a single row column from a viewobject in java?

    I have a class file that goes out and gets a viewobject and sets its where clause
    this is it:
    vcRow = vc.createViewCriteriaRow();
    vcRow.setAttribute("LogonId", "='" + strPcis_Login.toUpperCase() + "'");
    vc.addElement(vcRow);
    vo.applyViewCriteria(vc);
    vo.executeQuery();
    I know this working cause I can watch it in debug..
    but now the problem.
    I've looked in the docs and don't see how one can pull the value of the row it found and place it in a uix page in a textinput area
    how can I get a single row column, in this case the UserName that is in the view object to a string and then place it into my
    uix page? I've looked and looked and don't see a method for this.
    is there a way to take the oracle.cabo.servlet.Page and set a textinput with a viewobject get method?
    what way do you do this and where is it documented?

    is there a way to take the oracle.cabo.servlet.Page and set a textinput with a viewobject get method?
    what way do you do this and where is it documented? What you can do is get the value from your VO and set it somewhere that UIX can data bind to -- as a Page proprety, on HttpSession, etc. This is documented in Chapters 4 (Data Binding) and 5 (Controller) of the UIX Developer's Guide.
    To set a property, you use Page.setProperty(String key, String value). Then, in your UIX file, to make a textInput that has the value pulled from a given page property, use:
    <textInput data:text="key@ctrl:page" />
    -brian
    Team UIX

  • Can I add multiple elements on a single line?

    Can I add multiple elements on a single line?

    Not yet. But this is something we plan to support. You can vote on this idea here: http://forums.adobe.com/ideas/1046
    We use this to help prioritize our work.
    Randy

  • How do i set the background of the table( not of cell / row / column).

    How do i set the background of the table( not of cell / row / column).
    What happens when i load the applet the table is blank and displays the background color is gray which we want to be white.
    We tried using the setBackGround but it is not working maybe we are not using it properly. Any help would be gr8.
    Thanks in advance.

    I don't understand very well, but i guess that the background is gray when the table content's empty, isn't it?
    When the table model is empty, the JTable doesn't paint, so its container displays its background (often gray).
    In this case, what you must do is force the table to paint, even if the model is empty. So, you have to create your own table and override three methods :
    public class MyTable extends JTable
    //specify the preferred and minum size when empty
    myPreferredWidth = 200;
    myPreferredHeigth =200;
    myMinimunWidth = ...;
    myMinimunHeigth = ...;
    public Dimension getPreferredSize()
    if(getModel().getRowCount() < 1)
    return new Dimension(myPreferredWidth, myPreferredHeigth);
    else
    return super.getPreferredSize();
    public Dimension getMinimumSize()
    if( getModel().getRowCount() > 0)
    return new Dimension(myMinimunWidth, myMinimunHeigth);
    else
    return super.getMinimumSize();
    protected void paintComponent(Graphics g)
    if (getModel().getRowCount<1 && isOpaque()) { //paint background
    g.setColor(Color.white);
    g.fillRect(0, 0, getWidth(), getHeight());
    else super.paintComponent(g);
    }

  • To know how to add the elements present in the particular column

    I have created the ALV report with two columns namely vbeln and ntgew.In that i want to add the values of ntgew column.plz provide the query to do that.
    Edited by: Philip Eller on Jun 18, 2008 9:12 AM

    hi vivek,
    You posted the question in wrong forum.
    There is a forum seperately for ABAP.
    Jeyakanthan

  • Smartform  Issue.. Displaying the fields in a single row

    Hi All...
    In my smartform, the data are displaying in 2 different rows, even thought they are placed in a single row of a table.
    Its getting diplayed as follows..
              mat-123   10  kg
    100                                    2500.00       2500.00
    Now i would like to print 100 and 2500.00 in above row where mat-123 is getting displayed....
    Where to check and what to do ...????
    Please help me....
    Regards
    Pavan

    Hi Pavan,
                    Try increasing the column width of the table for this 'mat-123 10 kg'. then it should display in the same row.
    Regards,
    Hema.
    Reward points if it is useful.

  • How to add mouse listener for a single row alone

    I have a requirement. In a JTable when I double click a particular row the cells in the row should set to the width which I have provided.
    The problem with my code is when I click fourth row in the table, the first row gets adjusted.
    So how I need help is
    only if I click the first row, the first row cell size should get adjusted not when I click fourth row.
    Similarly if I give some cell width and height for fourth row cells, then when I double click the fourth row, the fourth should alone get adjusted and not the other rows.
    Hope I have explained clearly.
    How can it be achieved?
    Please find below my code. Everything is hardcoded. So it may look messy. Please excuse.
    // Imports
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    class SimpleTableExample extends JFrame {
    // Instance attributes used in this example
    private JPanel topPanel;
    private JTable table;
    private JScrollPane scrollPane;
    String data1 = "";
    String data2 = "123456789ABCDEFGHIJKLMNOPQRSTUVQWXYZabcdefghijklmnopqrstuvwxyzaquickbrownfoxjumpedoverthelazydog";
    int size = data2.length();
    // Constructor of main frame
    public SimpleTableExample() {
         // Set the frame characteristics
         setTitle("Simple Table Application");
         setSize(400, 200);
         setBackground(Color.gray);
         // Create a panel to hold all other components
         topPanel = new JPanel();
         topPanel.setLayout(new BorderLayout());
         getContentPane().add(topPanel);
         // Create columns names
         String columnNames[] = { "SEL", "DESIGN DATA", "PART NUMBER" };
         // Create some data
         String dataValues[][] = { { data1, data2, "67", "77" },
              { "", "43", "853" }, { "", "89.2", "109" },
              { "", "9033", "3092" } };
         DefaultTableModel model = new DefaultTableModel(dataValues, columnNames);
         model.addColumn("PART TITLE");
         model.addColumn("SPECIAL INSTRUCTIONS");
         table = new JTable(model) {
         public boolean isCellEditable(int rowIndex, int colIndex) {
              return false;
         // set specific row height
         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         int colInd = 0;
         TableColumn col = table.getColumnModel().getColumn(colInd);
         int width = 50;
         col.setPreferredWidth(width);
         int colInd2 = 1;
         TableColumn col2 = table.getColumnModel().getColumn(colInd2);
         int width2 = 100;
         col2.setPreferredWidth(width2);
         int colInd3 = 2;
         TableColumn col3 = table.getColumnModel().getColumn(colInd3);
         int width3 = 10;
         col3.setPreferredWidth(width3);
         int colInd4 = 3;
         TableColumn col4 = table.getColumnModel().getColumn(colInd4);
         int width4 = 10;
         col4.setPreferredWidth(width4);
         int colInd5 = 4;
         TableColumn col5 = table.getColumnModel().getColumn(colInd5);
         int width5 = 10;
         col5.setPreferredWidth(width5);
         table.addMouseListener(new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 2) {
              JTable target = (JTable) e.getSource();
              int row = target.getSelectedRow();
              int column = target.getSelectedColumn();
              TableColumn col1 = table.getColumnModel().getColumn(0);
              col1.setPreferredWidth(50);
              TableColumn col2 = table.getColumnModel().getColumn(1);
              col2.setPreferredWidth(400);
              table.getColumnModel().getColumn(1).setCellRenderer(
                   new TableCellLongTextRenderer());
              table.setRowHeight(50);
              TableColumn col5 = table.getColumnModel().getColumn(4);
              col5.setPreferredWidth(200);
         // Create a new table instance
         // table = new JTable(dataValues, columnNames);
         // Add the table to a scrolling pane
         scrollPane = new JScrollPane(table);
         topPanel.add(scrollPane, BorderLayout.CENTER);
    // Main entry point for this example
    public static void main(String args[]) {
         // Create an instance of the test application
         SimpleTableExample mainFrame = new SimpleTableExample();
         mainFrame.setVisible(true);
    class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
         boolean isSelected, boolean hasFocus, int row, int column) {
         this.setText((String) value);
         this.setWrapStyleWord(true);
         this.setLineWrap(true);
         // set the JTextArea to the width of the table column
         setSize(table.getColumnModel().getColumn(column).getWidth(),
              getPreferredSize().height);
         if (table.getRowHeight(row) != getPreferredSize().height) {
         // set the height of the table row to the calculated height of the
         // JTextArea
         table.setRowHeight(row, getPreferredSize().height);
         return this;
    Edited by: 915175 on Aug 3, 2012 4:24 AM

    Hi
    Try below code. Hope this will help
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    public class SimpleTableExample extends JFrame {
    private JPanel topPanel;
    private JTable table;
    private JScrollPane scrollPane;
    String data1 = "";
    String data2 = "123456789ABCDEFGHIJKLMNOPQRSTUVQWXYZabcdefghijklmnopqrstuvwxyzaquickbrownfoxjumpedoverthelazydog";
    int size = data2.length();
    // Constructor of main frame
    public SimpleTableExample() {
    // Set the frame characteristics
    setTitle("Simple Table Application");
    setSize(400, 200);
    setBackground(Color.gray);
    // Create a panel to hold all other components
    topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    getContentPane().add(topPanel);
    // Create columns names
    String columnNames[] = { "SEL", "DESIGN DATA", "PART NUMBER" };
    // Create some data
    String dataValues[][] = { { data1, data2, "67", "77" },
    { "", "43", "853" }, { "", "89.2", "109" },
    { "", "9033", "3092" } };
    DefaultTableModel model = new DefaultTableModel(dataValues, columnNames);
    model.addColumn("PART TITLE");
    model.addColumn("SPECIAL INSTRUCTIONS");
    table = new JTable(model) {
    public boolean isCellEditable(int rowIndex, int colIndex) {
    return false;
    // set specific row height
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    int colInd = 0;
    TableColumn col = table.getColumnModel().getColumn(colInd);
    int width = 50;
    col.setPreferredWidth(width);
    int colInd2 = 1;
    TableColumn col2 = table.getColumnModel().getColumn(colInd2);
    int width2 = 100;
    col2.setPreferredWidth(width2);
    int colInd3 = 2;
    TableColumn col3 = table.getColumnModel().getColumn(colInd3);
    int width3 = 10;
    col3.setPreferredWidth(width3);
    int colInd4 = 3;
    TableColumn col4 = table.getColumnModel().getColumn(colInd4);
    int width4 = 10;
    col4.setPreferredWidth(width4);
    int colInd5 = 4;
    TableColumn col5 = table.getColumnModel().getColumn(colInd5);
    int width5 = 10;
    col5.setPreferredWidth(width5);
    // Cell Render should apply on each column -- add by Rupali
    for(int i=0; i< table.getColumnModel().getColumnCount(); i++){
    table.getColumnModel().getColumn(i).setCellRenderer( new TableCellLongTextRenderer());
    table.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
    JTable target = (JTable) e.getSource();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    setTableCellHeight(table,row,column); //Added by Rupali
    TableColumn col1 = table.getColumnModel().getColumn(0);
    col1.setPreferredWidth(50);
    TableColumn col2 = table.getColumnModel().getColumn(1);
    col2.setPreferredWidth(400);
    TableColumn col5 = table.getColumnModel().getColumn(4);
    col5.setPreferredWidth(200);
    // Create a new table instance
    // table = new JTable(dataValues, columnNames);
    // Add the table to a scrolling pane
    scrollPane = new JScrollPane(table);
    topPanel.add(scrollPane, BorderLayout.CENTER);
    * Created By Rupali
    * This will set cell's height and column's width
    * @param table
    * @param row
    * @param column
    public void setTableCellHeight(JTable table, int row, int column) {
    // set the JTextArea to the width of the table column
    setSize(table.getColumnModel().getColumn(column).getWidth(),
    getPreferredSize().height);
    if (table.getRowHeight(row) != getPreferredSize().height) {
    // set the height of the table row to the calculated height of the
    // JTextArea
    table.setRowHeight(row, getPreferredSize().height);
    // Main entry point for this example
    public static void main(String args[]) {
    // Create an instance of the test application
    SimpleTableExample mainFrame = new SimpleTableExample();
    mainFrame.setVisible(true);
    class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    this.setText((String) value);
    this.setWrapStyleWord(true);
    this.setLineWrap(true);
    return this;
    }

  • "Could not fill because of an internal error" message everytime I try to content-aware fill a selection made by the single row/column marquee tool. Has worked fine for months and now all of the sudden i'm getting this error.

    Please help, I have no idea why this is happening and I need to be able to use this technique

    whoops, I was in the CC folder, not 2014.
    2014:09:02 18:07:57 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:09:09 16:13:37 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:09:10 17:02:15 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:09:12 16:24:44 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:09:17 16:50:57 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:09:18 22:55:01 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:09:23 15:20:45 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:09:25 14:00:06 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:10:03 15:51:35 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:10:07 15:16:13 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:10:09 15:15:52 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140730.r.148/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2014:10:14 15:08:51 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140926.r.236/photoshop/main/photoshop/xcode/.. /interfaces/UCopyOnModifyImp.h : 214 : REQUIRE failed
    2015:02:04 22:40:24 : /Volumes/workarea/PS_15_Mac_Daily_Retail/20140926.r.236/photoshop/main/photoshop/sources/ USheet.cpp : 439 : REQUIRE failed
    Im assuming the last line was when I attempted to deselect a couple pixels and it crashed

  • Can we have more than 1 UI element in a single table column?

    Hi All,
    For example, I want to have IMAGE, ProgressIndicator and LinkToAction together as a template in a table column.
    I already tried without success. I could only add single UI elements. After that, tools won't let me do it.
    Any help or suggestion will be appreciated.
    Sub

    Hi
    You can have at one time only one UI element in the table.
    if you want to have more than one type of editors in the table then you can use table cell editors as suggested above.
    but i guess you are referring here to grouping more than one UI element in one editor or one column.
    i think that is not possible as such.
    How ever what you can do is, make use of the TABLECOLUMNGROUP.
    instead of adding column directly to the table use TABLECOLUMNGROUP and add columns to this.
    create three table column for three UI elements you are reffering here and put them in this one TABLECOLUMNGROUP.
    and add rest of the column straight to the table.
    thanks
    sarbjeet

  • How to change the forecolor of a single row of a matrix

    In a matrix which is displaying list of items like the Sales Order Form, I am trying to change the forecolor to red for only those items where the item's required quantity is lesser than the item's avialable quantity.
    The Code Snippet is as follows:
    ReqQty = oMatrix.Columns.Item("ReqQty").Cells.Item(pval.row).Specific.value
    AvaQty = oMatrix.Columns.Item("AvaQty").Cells.Item(pval.row).Specific.value
    If ReqQty > AvaQty Then
    Dim txtField As SAPbouiCOM.EditText
    oMatrix = oform.Items.Item("cMatrix").Specific
    txtField = oMatrix.Columns.Item("ItemNo").Cells.Item (pval.row).Specific
    txtField.ForeColor = 200
    txtField = oMatrix.Columns.Item("ItemDesc").Cells.Item(pval.row).Specific
    txtField.ForeColor = 200
    oMatrix.Columns.Item("ReqQty").Cells.Item(pval.row).Specific
    txtField.ForeColor = 200
    oMatrix.Columns.Item("AvaQty").Cells.Item(pval.row).Specific
    txtField.ForeColor = 200
    End If
    But the problem is , if this condition applies to any one of the items in the matrix, then all the rows in the matrix change the forecolor to red.
    Has anyone faced this problem and has a solution to it?

    I haven't tested the problems you have for a matrix.
    But I have seen the properties are not exposed for the Cell object...
    Regarding the ForeColor and BackColor on the EditText they are deprecated starting from 2004 BUT you have the same properties now exposed at the <b>Item</b> level.
    For the Column object the ForeColor and BackColor are not market as deprecated.
    Regards
    Trinidad.

  • Output the element in a single line

    Hi all,
    I encontered a problem when using castor xml tool to gengerate an xml file.
    The parser that I an using is org.exolab.castor.parser=org.apache.xerces.parsers.SAXParser.
    And I set org.exolab.castor.indent=true in the castor.properties
    I got the following ouput:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE subscribers PUBLIC "...
    "subscriber.dtd">
    <subscribers provider="..."/>
    <user name="..."
    pass="..."/>
    </subscribers>
    What I expect is that the user element should be in a single line like following:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE subscribers PUBLIC "..." "subscriber.dtd">
    <subscribers provider="..."/>
    <user name="..." pass="..."/>
    </subscribers>
    What should I do to achieve this goal?
    I found there is a property which might be useful, but I don't know exactely how to use it:
    org.exolab.castor.features=
    thanks in advance

    Hello,
    I've found a solution:
    We can use our own Serializer to control the output format:
    In the castor.properities,
    by default org.exolab.castor.serializer=org.apache.xml.serialize.XMLSerializer
    I deprived this class and overrided all the constructors and the setOutputFormat method:
         public void setOutputFormat(OutputFormat arg0) {
              arg0.setIndenting(true);
              arg0.setLineWidth(0);
              super.setOutputFormat(arg0);     
    and it works fine
    Thanks anyway
    Message was edited by:
    laseine

  • How to display single row column with nested group function

    SQL> select deptno, Max(sum(sal)) SalSum
    2 from emp
    3 group by deptno;
    select deptno, Max(sum(sal)) SalSum
    ERROR at line 1:
    ORA-00937: not a single-group group function
    Can you please the Help me to get the Max(sum(sal)) with Deptno ......

    select deptno, sum(sal) SalSum
    from emp
    group by deptno;The ablove query will give only one value for SALSUM for a department. So there is no meaning on applying MAX on this for a department..
    What are you trying to achieve?
    This?
    select max(salsum) salsm,max(deptno) keep(dense_rank first order by salsum desc) deptno
    from(
    select deptno, sum(sal) SalSum
    from emp
    group by deptno);Edited by: jeneesh on Sep 4, 2012 6:00 PM

Maybe you are looking for