LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of 2d array to 1D and then Back to 2D. Need Help


Alain S wrote:

 

Dear mr. smercurio,

 

The “*-1” thing was just an example of processing the data.

That code is the only one posted so far that does what the OP asked for

     a) Convert 2D to 1D array

     b) Process the 1D array. What processing? I don’t know and I don’t care

     c) Convert back 1D to 2D array


Sorry. I misunderstood what you were trying to show.

 


If you have a better/faster solution to do those three steps feel free to post but so far we didn’t see any code from you L  

I did not post an example because the question was ill-formed. As stated, the question was "convert a 2D array to 1D array and then back to 2D in LabVIEW." A Reshape Array function will do this directly, but it doesn't make much sense without knowing what the poster is trying to accomplish. The code that the user originally posted made no sense, and it did not coincide with what the user said they were trying to do. So, I had no idea what the user wanted.

 

Please don't take my comments as discouragement. As I noted, I misunderstood the premise of your example. However, sometimes posting an example just for the sake of posting an example doesn't answer the question if the question is not clear or lacks necessary details. Sometimes new folks feel a need to prove themselves by posting answers or examples. Please do not fall into this trap. Smiley Wink

 

0 Kudos
Message 11 of 13
(549 Views)

Hi smercurio

 

what you said is "Sometimes new folks feel a need to prove themselves by posting answers or examples. Please do not fall into this trap. :smileywink: "

I am also new to labview,don't have much experience as you guys have.But i don't want to prove myself,sorry but i disagree with your statement you see my code, it is not at all perfect but i posted it so that  sometimes even a small hint can do a lot

and second reason to post that code is,i will get some useful tips on that code by experienced people like you, so thati will improve next time.I don't expect "making fun" thing from you guys, as i have experienced it before also.

sorry but this should not be the case, may be you also had started from beginning like us.

 

Gaurav kSmiley Sad

 

 

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 12 of 13
(536 Views)

Let's get one thing straight: I was not making fun of anybody's code. Second thing: My comment regarding the trap was not intended as discouragement, although apparently you took it as such. What I meant was this: all too often we see folks posting code that is inefficient or sometimes just plain wrong. These forums are not a popularity contest, but sometimes new folks seem to think so, and go about posting code just for the sake (I guess) of getting their post count up. I AM NOT IMPLYING THAT YOU ARE ONE OF THESE PEOPLE. I am not here to psychoanalyze you or anybody else. All that I meant is that if that's why you are (or anybody else is for that matter) posting code, then this is the wrong approach. I am NOT implying that your help is not appreciated or unwanted. However, as a volunteer I try to point out these instances so those users asking questions don't think that's the way it should be done and start programming incorrectly.

 

The original post was unclear as to what was actually required. The examples posted did not provide insight as to what was really wanted, and I still continue to say that the original poster (if they're still listening at this point) needs to clarify what they're actually trying to do.

 

In your specific case: your first example didn't make much sense. For one thing, you had hard-coded the loop iteration counts. I also have no idea what was the purpose of the case structure inside the for-loop. In your second example you used auto-indexing, but it still did not make any sense. The first loop would run for as many rows as the 2D array (4), but the second loop would only run for 3 iterations, since the last i value coming out of the first loop would be 3. This makes no sense.

 

There's a big difference between criticism and ridicule. The above comments are criticism. I'm sorry if my comments seemed acerbic or if you took them as "making fun" (which they were emphatically NOT). However, if I see someone posting code that either makes no sense, or is considerably more complicated than it needs to be then I will say so, and I intend to make no apologies for that.

0 Kudos
Message 13 of 13
(517 Views)