About 174,000 results
Open links in new tab
  1. c - Map a 2D array onto a 1D array - Stack Overflow

    Oct 27, 2017 · I want to represent a 2D array with a 1D array. A function will pass the two indicies (x,y) and the value to store. These two indicies would represent a single element of a 1D …

  2. python - From ND to 1D arrays - Stack Overflow

    I can take the first element of this array to manually convert it to a 1D array: b = np.reshape(a, (1,np.product(a.shape)))[0] but this requires me to know how many dimensions the original …

  3. C++ 2D array to 1D array - Stack Overflow

    Jun 13, 2014 · I am attempting to convert a 2D array to 1D. I'm extremely new to C/C++ but I think it's very important to learn how to convert a 2D array to 1D.

  4. java - How to convert a 1d array to 2d array? - Stack Overflow

    Create a 2d array of appropriate size. Use a for loop to loop over your 1d array. Inside that for loop, you'll need to figure out where each value in the 1d array should go in the 2d array. Try …

  5. c++ - Treating 2D array as 1D array - Stack Overflow

    Jun 11, 2018 · A 2D array cannot be treated as a 1D array. As noted by @KillzoneKid, the address of an array is not pointer interconvertable with that of the first element even though …

  6. java - Convert a 2D array into a 1D array - Stack Overflow

    Jan 20, 2012 · How to convert a 2D array into a 1D array? The current 2D array I am working with is a 3x3. I am trying to find the mathematical mode of all the integers in the 2D array if that …

  7. Convert a 1D array to a 2D array in numpy - Stack Overflow

    Sep 25, 2012 · I want to convert a 1-dimensional array into a 2-dimensional array by specifying the number of columns in the 2D array. Something that would work like this: > import numpy …

  8. how to convert 2D arrays to 1D array - NI Community

    Feb 2, 2005 · Hi all, I have a 2D array which contains the following information, [00] = 2 [01] = 5 [02] = 7 [03] = 9 Is it possible for me to convert this 2D array to 1D array such that it reads the …

  9. How can I reshape a 2D array into 1D in python? - Stack Overflow

    Oct 29, 2022 · If what you are interested is that the flatten array still prints in 3 lines, well, no. You can see here that people who want to do that start with the exact reverse operation: reshape …

  10. python - Merging 1D arrays into a 2D array - Stack Overflow

    Mar 16, 2018 · Is there a built-in function to join two 1D arrays into a 2D array? Consider an example: X=np.array([1,2]) y=np.array([3,4]) result=np.array([[1,3],[2,4]]) I can think of 2 simple …