LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate a matrix from 3 column data

Solved!
Go to solution

I am wanting to generate a matrix using the attached data so that x is row 1 and y is column 1. I tried splitting the array and using build array however It didn't work. I've checked the forums but no luck. any insight would be appreciated

Download All
0 Kudos
Message 1 of 6
(2,406 Views)

@matthewk wrote:

I am wanting to generate a matrix using the attached data so that x is row 1 and y is column 1. I tried splitting the array and using build array however It didn't work. I've checked the forums but no luck. any insight would be appreciated


I assume that you probably meant: Column 1 is x, Column 2 is y, and column 3 is the value at cell x,y.

 

All you need is initialize an array of the proper size, keep it in a shift register, and then replace values in order. Here's a quick draft. You can easily swap rows and columns if needed.

 

Of course negative indices are not allowed, so you need to create a proper offset such that the lowest index is zero. You could display it in an intensity graph and set the axis offsets accordingly.

 

 

I simply pasted the excel data into a text diagram constant. You can save the excel file as tab delimited text, then use "read from spreadsheet file".

Message 2 of 6
(2,399 Views)

Alenbach,

 

Thank you so much for the help. Unfortunately I'm not sure what you used to split the array

 

 

Untitled.jpg

0 Kudos
Message 3 of 6
(2,384 Views)
Solution
Accepted by topic author matthewk

"Index array" resized for three outputs. If you have a 2d array, leaving the bottom index unwired gives you a row and leaving the top index disconnected gives you a column. Wiring both indices gives you an element. Check the online help.

 

My picture above is a snippet. Drag it to the diagram (LabVIEW 2012) and it will turn into runnable code.

Message 4 of 6
(2,372 Views)

Altenbach,

 

Works great. Thanks for all the help. I learned a lot

 

 

K

0 Kudos
Message 5 of 6
(2,342 Views)

Then you should mark Altenbach's message as the solution to your problem rather than your own thank you message to give credit where credit is due.

 

First you will have to go to the options menu to the upper right of your message and pick "unmark as solution".

0 Kudos
Message 6 of 6
(2,338 Views)