01-21-2021 10:52 PM
I have a 2d array and I want to insert it into a[1][0]=5
I tried this but not working!
Solved! Go to Solution.
01-21-2021 11:26 PM
Attach a VI rather than a picture.
Clean up the code before posting. I can't clearly tell which constants go to which inputs in your picture.
Save the input data as default. Tell us what you expect vs. what you are getting.
What is a[1][0] supposed to mean?
I don't understand why you are taking a 2-D array and reshaping into a 1 x 0 array. So right there you are generating an empty array. Nothing downstream of that will make any sense.
01-21-2021 11:57 PM - edited 01-22-2021 12:01 AM
Here a[1][0]=5 means
if a is
1 2 3
4 5 6
7 8 9
then replace 1st row and 0th col of a i.e 4 with 5
Yes Raven you're right replacing that 1,0 for the first block with the size of that matrix worked!
but this is creating an empty array as you said, I tried without that first block too but that has the same efffect
Anything can be done to replace just an index?
01-22-2021 12:47 AM
Hi gpt,
@gptshubham595 wrote:
Anything can be done to replace just an index?
Sure: Use ReplaceArraySubset to replace elements/subsets of an array.
Why do you think you need to place additional functions for that purpose?
Your questions shows lack of basic LabVIEW knowledge: in your other thread you already got suggestions to take basic LabVIEW training. Did you?
01-22-2021 01:11 AM
Yes, I tried from my side and solved this!
Thank you!
01-22-2021 08:01 AM
@gptshubham595 wrote:
Here a[1][0]=5 means
if a is
1 2 3
4 5 6
7 8 9
then replace 1st row and 0th col of a i.e 4 with 5
Yes Raven you're right replacing that 1,0 for the first block with the size of that matrix worked!
but this is creating an empty array as you said, I tried without that first block too but that has the same effect
Anything can be done to replace just an index?
Yes. As I said, get rid of that Reshape Array function. Just use Replace Array element!
What was your thought process that made you put Reshape Array in there?
01-22-2021 01:45 PM
Initially when I was learning I followwe this
Insert Item Into Any Array Index - Discussion Forums - National Instruments (ni.com)
I saw them using this so I thought to use this
01-22-2021 02:06 PM
That example is for inserting a new element into the array. And the resize array is only uses in the one case where the element to be inserted is after the length of the array.
You aren't doing that. You are replacing an array element that already exists.
01-22-2021 02:15 PM - edited 01-22-2021 02:17 PM
Yes!
Already Solved that by the way!
Thank You!