Tagged Questions
Multidimensional-arrays can be described as multi-dimensional tables. Each index used in order to find a given element is called a dimension.
1
vote
1answer
29 views
Searching in Multi Dimensional Array
I have the following parent array and I am trying to get the element that is missing from another array when compared to this parent. Need to compare with module and action to be the same.
Parent
(
[...
-3
votes
1answer
53 views
My C program is exiting with a non-zero status and I don't know why. Currently running the code in repl.it [on hold]
Hi I'm currently running a code in c programming, and it keeps exiting with a non-zero status.
The code is being used for a sudoku game and what I'm essentially trying to do is generate a random 9x9 ...
0
votes
1answer
7 views
Recursively crawl data folder and create multidimensional array
So I have the following situation. In my project folder I got a 'data' folder that contains .json files. These .json files also are structured in nested folders.
Something like:
/data
/content
...
0
votes
2answers
15 views
Filling a multidimensional array PHP
I need to fill a multidimensional array arrayFinal so that it looks like this:
$arrayFinal = array(
array('Number' => 1, 'isEven' => false, 'isPrime' => true),
array('Number' => 2,...
0
votes
3answers
45 views
Javascript push object into multidimensional array loop
I currently have this multidimensional array:
var locations = [
['Event', 'Monday', 50.820250, -0.143534, 'Image', 'fa fa-heart'],
['Event 2', 'Tuesday', 50.819939, -0.140978, 'Image', 'fa fa-...
2
votes
1answer
39 views
Why is `a += x` and `a = a + x` implemented differently for a nested list? [duplicate]
If I build a nested list:
nested_list = 3*[[]]
and if I then add elements to it
nested_list[1] += [1, 2, 3]. returns:[[1, 2, 3], [1, 2, 3], [1, 2, 3]]
nested_list[1] = nested_list[1] + [1, 2, 3]. ...
1
vote
6answers
45 views
Average of bidimensional array's columns with array.map()
I have an array that looks like this:
var array = [ [1,3,9],
[4,6,8],
[3,7,5],
[2,8,4] ];
I want to get the average number of each column, but for now I was ...
0
votes
1answer
40 views
PHP: Easiest and cleanest way to modify multidimensional array?
I have a dynamic multi-dimensional array that can be of any dimension here is a sample..
$array_serial = 'a:2:{i:0;a:2:{s:2:"id";a:4:{s:3:"url";s:27:"products.php?la=electronics";s:6:"otitle";s:11:"...
0
votes
0answers
27 views
Create instance from 2d array
I'm using JavaML to classify data from a bluetooth sensor. For now my data was split into arrays of doubles i was creating the instances like this:
startData.add(new DenseInstance(double[] xyz, "...
2
votes
1answer
18 views
Get value of next element in array of arrays
I have an array containing an array key of a date, with the value being another array.
Array ( [2017-01-01] => Array ( [available] => 1 ) [2017-01-02] => Array ( [available] => ) [2017-01-...
3
votes
1answer
32 views
PHP process 2-column data input
I want to take an input file (data.txt), where 1st column is a name, and 2nd is a 2-decimal number ... process the whole file no matter how many lines it has ... and get an output with 3 columns ... 1)...
0
votes
1answer
29 views
Android Video Game Using 2D Array - Find connecting matches
Okay, I am building a game in my free time for fun. This is not for work or school. I graduated. What I didn't do is graduate in game programming so I am learning it as I go. I have developed a couple ...
0
votes
2answers
21 views
Why do the values of array elements are not getting printed and generating notice when put inside double quotes?
As per my knowledge if PHP variables are echoed inside double quotes they get printed on screen.
For example :
<!DOCTYPE html>
<html>
<body>
<?php
$jumbo = "JumboJet"...
0
votes
3answers
24 views
How to convert 2Darray into 2D ArrayList in java?
I have searched similar questions and I still cannot find the solution for my case. So basically, I have a 2D array called 'array2D' and I am trying to convert those into 2D arrayList. I tried to ...
1
vote
1answer
35 views
How to check if a timestamp is within a range using a dynamic array
I am trying to write a code that identifies what time period or 'session' a timestamp falls into and am having some problems. I have an array that varies depending the the number of user inputs (see ...
2
votes
1answer
64 views
find smallest number in array javascript [duplicate]
What would be the most efficient way to take n smallest numbers from Array in Javascript
[[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]
Result is
[1,13,32,1]
0
votes
0answers
52 views
Replacing multi-dimensional array values with values in another multi-dimensional arrray
So long story short, I have two arrays:
$players - This array matches player names to their ids by round
array (
1 =>
array (
'[GPS]Alt_Stab' => '1',
'[SUC]Caution' => '43',
...
-3
votes
5answers
171 views
+50
How to group an array into subarrays using its keys?
I am looking to group an array into subarrays based on its keys.
Sample Array
Array
(
[0] => Array
(
[a_id] => 1
[a_name] => A1
[b_id] =>...
0
votes
2answers
30 views
How to pass 2d array of any type
int main(void) {
int no, flimit, i, pos_of_fval, freq_of_fval, n, j;
long long int max;
scanf("%d %d", &n, &flimit);
char list[n][21];
long long int fval[n];
char disp[...
0
votes
2answers
37 views
Similar to battleships. How do i print descending order with a border like so?
So I have a program that I created which is a game based upon floors and rooms in a building. The size of the rows and columns of the 2D array can change based upon user input. What I am trying to do ...
0
votes
0answers
26 views
find unique entries inside a multidimensional javascrip array, order important dependent on level
What would be the most elegant solution to find all unique first level entries inside a multidimensional javascript array? There is only one important rule: the order of the entries is important only ...
-1
votes
0answers
45 views
C# best way to access 3D array of structs
Hello fellow programmers. So I have a structure, and have come up with 3 different 3D arrays to store it in. Thing is, optimization is not my specialty and I need advice from someone who knows their ...
0
votes
3answers
35 views
Javascript loop error: Uncaught TypeError
I am practicing Javascript and have the following code which returns an Uncaught TypeError: Cannot set property '0' of undefined error on the sets[i][j] = initial_sets [i][j]; line. The idea seems to ...
1
vote
1answer
35 views
Using jagged with multidimensional arrays
New member here. There are a lot of posts about arrays, but I haven't seen this so I'm wondering if this is possible.
I have a gameboard that is 11 x 10. I have an array to lay out the squares. The ...
1
vote
3answers
35 views
How to calculate the number of elements in multidimentional arrays?
i've had this question ever since i learned two dimensional arrays... and i hope someone can clarify things for me..
here's what i know
int[] x= new int[2];
this one dimensional array has two ...
2
votes
3answers
59 views
Sum array columns and store the results in a bidimensional array (Javascript)
I'm using Google Sheets's Script Editor to operate between the values of a table/array. I've got a table that looks like this:
| UserA | UserB | UserC |
Movie1 | 2 | 8 | 6 |
Movie2 ...
-1
votes
0answers
30 views
Indexing multidimentional array in C with pre-postincrement with gcc [duplicate]
I believe the problem in the code is self-explanatory:
#include <stdio.h>
int a = 0, b = 0;
int i = 0;
int d[][3][2] = {4,5,6,7,8,9,10};
int main()
{
i = -1;
a = (int*)&d[i++][++i]...
0
votes
1answer
14 views
2d matrix sml inserting to list - simple code
I have an sml-nj project in which I want to work with a 'list of lists' structure, which has "Squares". I'm trying to insert values to the list of lists recursively, but I still haven't understood how ...
0
votes
3answers
64 views
JSON String to JS Array
How to convert folder structure JSON String to JS Array. I've following JSON string
[{ "Name": "A", "ParentName": "Config", "Type": "default" },
{ "Name": "SubA", "ParentName": "A", "Type": "...
0
votes
2answers
43 views
Reading in integers to a 2D array
I need help with reading integers into a 2D square array of N x N dimensions.
For example, if the user input is:
123
333
414
Then I will need an array:
{
{1, 2, 3},
{3, 3, 3},
{4, 1, 4}
}...
1
vote
1answer
17 views
Parsing json key value in PHP (multidimensional array)
By now I think I 'tried' just about all of the suggested ways to parse the value of one or more keys from a POST response. I've been able to boil it down a little but I'd super appreciate any help ...
1
vote
5answers
3k views
echo a complex array and indent subarrays
I have a complex array, something like that:
Array {
k1 => text1
k2 => Array {
k3 =>text2
k4 => Array {
...
3
votes
1answer
36 views
Asigning matrix element by list of tuple keys
I've got a 2dim database as a numpy.array (time,field values). Secondly I have a np.array of tuples, containing the coordinates of the field in the same order. What I want to do now is to reshape the ...
2
votes
2answers
45 views
How can I merge the elements of three arrays with same ID's?
I have 3 database queries (For query results overview see below!).
How can I merge the elements of this three arrays (with more than 200.000 products in DB) together without duplicate array keys and ...
0
votes
2answers
17 views
Validate multidimensional array using jQuery validate plugin
I have created form like this :
<form>
<div class='row user">
<div class="col-md-6 col-sm-6 input-group">
<input type="text" class="form-control" ...
1
vote
1answer
1k views
Forming numpy array from array buffer from shared memory (multiprocessing) fails
I need to have a multidimensional array in a shared memory between two processes. I'm trying to make a simple example that works: I send [1, 2, 3, 4, 5, 6, 7, 8, 9] to the other process, which ...
0
votes
1answer
38 views
Not swapping rows of 2D matrix correctly with pointers - C
This is a simple program. The purpose is to switch the row 'q' with the row 'q+1'. Strangely it didn't work as it should at first, not all the rows were swapped correctly. Then I brought the temp ...
2
votes
4answers
47 views
Safely check whether an element in a multidimensional array is undefined in JavaScript? [duplicate]
I want to find out whether an element in some multidimensional array x is undefined, for example:
typeof x[i][j][k] === 'undefined'
The problem is that if for example x[i][j] is undefined I get an ...
2
votes
2answers
71 views
Find the unique rows in Binary 2D array
Print the row numbers which are unique.
The following is my implementation:
#include <iostream>
#include <cmath>
int rowsToInt(int m[][5], int row, int cloumLen) {
int sum = 0;
/...
0
votes
3answers
89 views
JavaScript: For loop to build multidimensional array automatically
Hello I have been working on the following code and unstructured content with cheerio.js for the past few hours.
So far I have not been successful and would really appreciate your help.
I am ...
15
votes
3answers
14k views
Best way to initialize and fill an numpy array?
I want to initialize and fill a numpy array. What is the best way?
This works as I expect:
>>> import numpy as np
>>> np.empty(3)
array([ -1.28822975e-231, -1.73060252e-077, 2....
-1
votes
1answer
22 views
Numpy transpose data in example
So I'm finding this hard to visualise but essentially I've read in some data using numpy (python3.x) with
np.genfromtext()
which gives me a 3d array of shape (5, 1024, 2). Essentially 5 arrays, ...
0
votes
1answer
34 views
Ruby 2d array of hashes with runtime-decided length
I am trying to do something like this in a ruby module:
def initialize
super
@@main_array = Array.new(16) { Array.new}
end
def add_hash(hash={})
@@main_array[get_id] << hash
end
# ...
0
votes
1answer
25 views
MongoDB Multidimensional Arrays Flatten In Aggregation
I have the following doc:
{
"items" : [
[
{
"itemID" : "arSiPKXhqAXQ8MwMA",
"name" : "Item number 1",
"complexDrink" : false,
"real" : ...
3
votes
1answer
69 views
C Multiple arrays permutations algorithm
I'm trying to write a program that generates permutations upon a list of words stored into several arrays.
For example, my program asks for 2 groups of words like this :
words #1: abc def ghi
words #...
1
vote
4answers
28 views
Reading a text file into a 2D array
I need to read a text file into a 2D array, I can read files into the program perfectly fine (see my code below) however I cannot get my head around how to read them into a 2D array. The array the ...
0
votes
1answer
25 views
retrieve specific key value from multidimensional array
I have the following array, since i converted the string i got back from a SOAP call to an array:
Array
(
[soapenvBody] => Array
(
[queryRequestsResponse] => Array
...
3
votes
4answers
45 views
How to check the array key in a multidimensional array?
How to check if an array key exist or not array within array?
I need check the user id exist in array, i have below array found,
Array
(
[0] => Array
(
[user_id] => ...
1
vote
3answers
42 views
How to create 1D array from 2D array or multi array in PHP?
I have an array which looks like this
Array
(
[0] => Array
(
[0] => RANO17
[1] => RANO99
)
[1] => Array
(
[0] => Test Product Ranosys
[1] =...
0
votes
0answers
32 views
Python 2.7 2d lookup - Any pointers?
I'll really appreciate if someone could assist me with the following challenge.
I have two tables:
1 – masterTable – A 2d pivot table containing items in the rows and time in the columns (time ...