multidimensional-array

What is differences between Multidimensional array and Array of Arrays in C#?

What is differences between Multidimensional array and Array of Arrays in C#? if there a difference. What is the best use for each one? ...

Multidimensional Arrays in a struct in C#

I'm trying to convert the following (shortened for readability) to C# and running into problems #define DISTMAX 10 struct Distort { int a_order; double a[DISTMAX][DISTMAX]; }; I thought in structs it was a simple case of using "fixed" however I'm still getting problems. Here's what I've got (With a define higher up the page): ...

Help merge 2 arrays and sort by key

I am having some trouble with a basic php issue and want to know if anyone can help me out. Basically I need to combine the results of 2 queries, and merge the arrays based on the key, while retaining the 1 key to 1 value that is present in both queries. For example: "select * from table 1, table 2 where table1.id = table2.id"... ma...

Using array_multisort on the same array multiple times?

I have a largish table of data pulled from my database (~1500 rows, each with 10-15 fields) and I'm doing a number of filters and generating some stats and storing these in an excel spreadsheet for the user to download. Rather than hit the database with the same fairly-complicated query over and over with only minor modifications (to th...

C array is displaying garbage data (memory problems?)

I'm making a driver for an 8x8 LED matrix that I'm driving from a computer's parallel port. It's meant to be a clock, inspired by a design I saw on Tokyoflash. Part of the driver is an array of 3*5 number "sprites" that are drawn to the matrix. A coordinate of the matrix is assigned to a coordinate of the sprite and so forth, until the...

Multi-Dimensional Array ( C++ )

I'm trying to store a pointer in an array. My pointer to a pointer is class object is: classType **ClassObject; So i know i can allocate it by using the new operator like this: ClassObject = new *classType[ 100 ] = {}; I'm reading a text file, with punctuation and here is what i have so far: // included libraries // main function...

multidimensional PHP array or multiple queries to mysql DB

Hi there I'm using the PHPExcel lib which it seems to do great jobs, but in my approach it doesn't seem to be so fast. I need to generate a excel file with allot of sheets, data, formulas and styles(bold, color, border) and it takes me allot of computing resources and time. I think that my approach is not so good. Which has to be the ri...

Linking Two Multi-Dimensional arrays using pointers

I need to basically merge a Binary Heap, and Linear Probing Hashtable to make a "compound" data structure, which has the functionality of a heap, with the sorting power of a hashtable. What I need to do is create 2 2 dimension arrays for each data structure (Binary Heap, and Hash) then link them to each other with pointers so that when ...

How do I iterate rows and columns of a multidimensional array?

I would like to iterate the rows and columns separately on a two dimensional array: object[,] values; How would I iterate through just the rows and just the columns? ...

PHP foreach loop through multidimensional array

I have an array: $arr_nav = array( array( "id" => "apple", "url" => "apple.html", "name" => "My Apple" ), array( "id" => "orange", "url" => "orange/oranges.html", "name" => "View All Oranges", ), array( "id" => "pear", "url" => "pear.html", "name" => "A Pear" ) );...

Easily access an array based on its dimensions

Lets say I have an array which has n dimensions. Now in order to access a slot you typically use: array [1][0] What if the number of dimensions are not known at compile-time, is there an easy access like: slot = "1,0" array [slot] // accessing 1,0 Which means I can also easily navigate back and forth slot += ",2" array [slo...

How can I make this multidimensional array and these foreach loops work together?

// a beautiful multidimensional array public $form = array ( array( 'field' => 'email', array( 'params' => array( 'rule' => 'email', 'on' => 'create', 'required' => true, ), ), ...

What's the best way to set all values of a three-dimensional array to zero in Java?

I have a three-dimensional array that I want to reset to zero. It seems that there should be an easy way to do this that doesn't involve three for loops: for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { cube[i][j][k] = 0; } } } ...

editing a multidimensional array with [index]es, not only [name]s

public $form = array ( array( 'field' => 'email', 'params' => array( array( 'rule' => 'email', 'on' => 'create', 'required' => true, 'error' => 'The email is invalid!' ), array( 'ru...

Simple data storing in Python

I'm looking for a simple solution using Python to store data as a flat file, such that each line is a string representation of an array that can be easily parsed. I'm sure python has library for doing such a task easily but so far all the approaches I have found seemed like it would have been sloppy to get it to work and I'm sure there ...

multidimensional mixed associative/numeric array shifting

hi everyone, i have an issue i need to fix sooner than later. if i had the time to rewrite the entire script i would, but such is the life of a programmer, right? anywho, i've taken over a project and i have a multidimensional mixed associative/numeric array like so: Array ( [item1] => Array ( [dataset] => Array...

Code Separation Paradox: Create HTML Tree from Multi-Dimensional Array AND Keep the HTML Outside of the Recursive Function

This working code seems to be the typical solution to this problem. It takes a multi-dimensional array that holds categories and their subcategories (with no implied limitation on how many levels deep it goes) and creates an HTML unordered list from it, echoing it out onto the page from inside a recursive function. Sub-levels are trave...

Sort arrays into multidimensional array by key

I have a database table which gives me the following result: array(8) { ["link_id"]=> string(2) "20" ["link_url"]=> string(56) "http://url.of/website" ["link_name"]=> string(34) "Website title" ["link_target"]=> string(0) "" ["link_description"]=> string(0) "" ["link_updated"]=> string(19)...

Sorting multi-dimensional array using array_multisort, where you don't know the dimensions of the array

Hi, I have a multi-dimensional array, which basically consists of one sub-array for each year. So, for example, if I had three year's worth of data, it might look like this: $data[0] = Array(0,1,2,3,4,5,6,7); $data[1] = Array(6,5,4,3,6,7,8,9); $data[2] = Array(1,4,2,5,7,3,1,4); Now I want to be able to sort those arrays on the basis ...

Dijkstra algorithm for 2D array in Java

Hiya guys!! This is my first post, and this is for a school project; I'm running into a huge amount of trouble, and I can't seem to find a understandable solution. a b c d e z a - 2 3 - - - b 2 - - 5 2 - c 3 - - - 5 - d - 5 - - 1 2 e - 2 5 1 - 4 z - - - 2 4 - Thats the two dimensional array. So if you want to find the shortes...