tagged [multidimensional-array]

How do I 'foreach' through a two-dimensional array?

How do I 'foreach' through a two-dimensional array? I've got a two-dimensional array, And I'd like to `foreach` through it like this, But, I get the error: > Can't convert

7 May at 14:35

Using Linq with 2D array, Select not found

Using Linq with 2D array, Select not found I want to use Linq to query a 2D array but I get an error: > Could not find an implementation of the query pattern for source type 'SimpleGame.ILandscape[]'....

19 Jul at 15:31

Multi-dimensional array vs. One-dimensional

Multi-dimensional array vs. One-dimensional This is basically a restatement of this question: [Java: Multi-dimensional array vs. One-dimensional](https://stackoverflow.com/questions/2512082/java-multi...

How to search in 2D array by LINQ ?[version2]

How to search in 2D array by LINQ ?[version2] I have an array like this: i search in column by statement and return in column like this: ``` string className = "A"; string color = "Black"; for (int i ...

Fastest way to zero out a 2D array in C#

Fastest way to zero out a 2D array in C# I have a 2D array that I want to clear and reset to 0 values. I know how to clear a vector (1D array) using `Array.Clear()` but I don't know the best way to cl...

How do I iterate through each element in an n-dimensional matrix in MATLAB?

How do I iterate through each element in an n-dimensional matrix in MATLAB? I have a problem. I need to iterate through every element in an n-dimensional matrix in MATLAB. The problem is, I don't know...

I want to scramble an array in PHP

I want to scramble an array in PHP I want PHP to randomly create a multi-dimensional array by picking a vast amount of items out of predefined lists for n times, but never with 2 times the same. Let m...

14 May at 19:52

Two dimensional array in python

Two dimensional array in python I want to know how to declare a two dimensional array in Python. The first two assignments work fine. But when I try to do, `arr[1].append("bb1")`, I get the following ...

12 Oct at 04:53

How to "flatten" a multi-dimensional array to simple one in PHP?

How to "flatten" a multi-dimensional array to simple one in PHP? It's probably beginner question but I'm going through documentation for longer time already and I can't find any solution. I thought I ...

3 Dec at 03:55

PHP multidimensional array search by value

PHP multidimensional array search by value I have an array where I want to search the `uid` and get the key of the array. ## Examples Assume we have the following 2-dimensional array: ``` $userdb = ar...

22 May at 07:56

How to get a dimension (slice) from a multidimensional array

How to get a dimension (slice) from a multidimensional array I'm trying to figure out how to get a single dimension from a multidimensional array (for the sake of argument, let's say it's 2D), I have ...

PHP: Get key from array?

PHP: Get key from array? I am sure that this is super easy and built-in function in PHP, but I have yet not seen it. Here's what I am doing for the moment: Could I do something like the following inst...

What is the difference between T[,] and T[*,*]?

What is the difference between T[,] and T[*,*]? My Google-Jitsu is failing me. Question is in the title... What is the difference between `T[,]` and `T[*,*]`? I am looking for a 2, 2-1/2 part answer: ...

The best way to print a Java 2D array?

The best way to print a Java 2D array? I was wondering what the best way of printing a 2D array in Java was? I was just wondering if this code is good practice or not? Also any other mistakes I made i...

How to convert list of arrays into a multidimensional array

How to convert list of arrays into a multidimensional array I need to convert the following collection into double[,]: All the arrays in the list have the same length. The simplest approach, `ret.ToAr...

How can I get descriptive statistics of a NumPy array?

How can I get descriptive statistics of a NumPy array? I use the following code to create a numpy-ndarray. The file has 9 columns. I explicitly type each column: Now I would like to get some descripti...

Why is the enumeration value from a multi dimensional array not equal to itself?

Why is the enumeration value from a multi dimensional array not equal to itself? Consider: How can this be explained?

Convert a 1D array to a 2D array in numpy

Convert a 1D array to a 2D array in numpy 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: D...

ReDim Preserve to a multi-dimensional array in VB6

ReDim Preserve to a multi-dimensional array in VB6 I'm using VB6 and I need to do a `ReDim Preserve` to a Multi-Dimensional Array: Whenever I do it as I have written it, I get the following error: > r...

How can I split an array into n parts?

How can I split an array into n parts? I have a list of bytes and I want to split this list into smaller parts. This list has 6 cells. For example, I want to split it into 3 parts containing each 2 by...

How do you rotate a two dimensional array?

How do you rotate a two dimensional array? Inspired by [Raymond Chen's post](https://devblogs.microsoft.com/oldnewthing/20080902-00/?p=21003), say you have a 4x4 two dimensional array, write a functio...

How to initialize multi-dimensional array with different default value

How to initialize multi-dimensional array with different default value I am trying to initialize 2-dimensional array of integer values with -1. When I create a new array, it is automatically filled wi...

Span and two dimensional Arrays

Span and two dimensional Arrays Is it possible to use the new [System.Memory Span struct](https://msdn.microsoft.com/en-us/magazine/mt814808.aspx) with two dimensional arrays of data? ``` double[,] te...

Multidimensional arrays in Java and C#

Multidimensional arrays in Java and C# In C# there are 2 ways to create mutlidimensional arrays. ``` int[,] array1 = new int[32,32]; int[][] array2 = new int[32][]; for(int i=0;i

Does Array.Copy work with multidimensional arrays?

Does Array.Copy work with multidimensional arrays? This code works fine: But I am not having much luck replacing it with Array.Copy. Basically, if the resized array is larg

1 Sep at 02:26