Questions tagged [data-structures]

Questions on using or implementing more or less common data structures such as linked lists, structs, trees, tries, heaps etc. in Mathematica.

Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

Dataset column names not showing and entire dataset renders in closed form

My row names show just fine hut Unsure why column names no6 displaying and dataset renders in a closed-looking elided form. I want the entire dataset rendering open. If you do not have the time or the ...
user avatar
  • 1,829
0 votes
0 answers
30 views

How to Plot data that has been arranged in a table and is related to a function

I have a set of data that I want to Polt in two dimensions. The . function has been used ListLinePlotBut I did not get the desired result ...
user avatar
3 votes
1 answer
58 views

Question on splitting into individual cycle from a list of 30 cycles dataset

Hi I have a set of data and will like to find out I can split these 30 cycles into each individual cycle? Do I use the for loop function in this application. Thanks for the help in advance. ...
user avatar
  • 302
0 votes
1 answer
131 views

How to rotate matrix? [closed]

Consider the matrix 'm1' : m1 = RandomReal[{0, 1}, {100, 100}]; The question is, how to rotate the 'm1' data 45 degrees and extract the matrix 'm2' from it (shown ...
user avatar
  • 969
1 vote
1 answer
52 views

selecting specific part of data set [closed]

I have data set in form {section, Arcangale ,X,Y, type}. Section is the number between 1 to 3 (1,2,3), Arcangale is number change from 0 to 1 something like this (0.0176575), x and y are coordinate (...
user avatar
  • 383
0 votes
0 answers
58 views

Heap.m data structure package in Mathematica (Book: Computer Science with Mathematica, CUP press)

The CUP press book Computer Science with Mathematica discusses heaps in section 8.4.3. The package Heap.m is mentioned (for import), containing functions such as HeapPlot. Can you advise where to find ...
user avatar
  • 1,004
2 votes
1 answer
141 views

How to convert a dataset into an alternative format

I have the following dataset: ...
user avatar
  • 4,391
18 votes
3 answers
491 views

Difference between HashTable datastructure and Association datastructure

Is there a difference in the runtimes between CreateDataStructure["HashTable"] and <||> in terms of inserting, ...
user avatar
  • 558
6 votes
0 answers
120 views

Mutable objects in Wolfram Language

I've seen some posts about mutable objects in WL and some implementations: Once more on object orientation in Mathematica: does it have to be so hard? Immutability, Association and typing Code ...
user avatar
  • 198
0 votes
1 answer
106 views

Import structure from Matlab into Mathematica 12 and nested lookup

I use Matlab and generate data that I save in a structure in a MAT file. I want the results to be loaded into Mathematica, as several analysis and plots are best when done in the latter than in the ...
user avatar
10 votes
1 answer
251 views

Using DataStructures in FunctionCompile

This is a follow up to this StackExchange question I am trying to do the equivalent of Select on a "FixedArray" data structure. Here is what I have tried so far: ...
user avatar
  • 2,160
2 votes
0 answers
32 views

Implementing array with partial cyclic data?

I'd like to construct an array where some columns are cyclic. As an illustrative example, take Table[Mod[k, 2^i], {k, 2^10}, {i, 0, 10}] //Grid, where the vast ...
user avatar
  • 611
1 vote
1 answer
41 views

Logarithmic steps inside a Do

I have trouble, i need to do several computations inside a loop using values in a logaritmic scale, is this possible? Inside of the cicle i create a several data sctructures, and it currently works ...
user avatar
0 votes
2 answers
70 views

Create list of functions, domains, and iterate over (compare to Python code)

In Mathematica, I want to do a mass export of many different animated plots of specific functions with different domains. Because I don't necessarily want the plots to always have exactly the same ...
user avatar
  • 571
3 votes
2 answers
136 views

Restrict kinds of heads when dealing with level concept

In[1] Map[(# + 7) &, {a, 3 b, {c, d}, e}, {2}] Out[1] {a, 10 (7 + b), {7 + c, 7 + d}, e} But I want feature like ListMap : ...
user avatar
  • 2,825
2 votes
0 answers
55 views

Handling lists indexed with integer partitions

I am trying to do some exploration around the multi-dimensional version of [truncated moment problem], where I work with various distributions (uni- or multi-variate), and use some truncated moment ...
user avatar
  • 658
0 votes
2 answers
60 views

Finding the number of unique solutions in a .txt file

Well, my question is the following: I have a .txt file that consists of the following data: ...
user avatar
  • 1,723
0 votes
1 answer
116 views

Exporting a multi excel files into one file

Suppose a list of students'grades in excel: "excel files" I want to write a program separate student grades to their respective classes and then write them in one excel file. What should I ...
user avatar
0 votes
0 answers
81 views

Quick questions about a document example for Components and Data Structures

NDSolve can be broken into several basic steps for advanced usage according to Components and Data Structures. In the documentation, a simple example is given as ...
user avatar
  • 661
1 vote
0 answers
42 views

Problem of application of HashTable in Fibonacci

As we can see the example in ref/datastructure/HashTable This code show the usage of HashTable, Fib is the implement of Fibonacci Number with HashTable. If we ...
user avatar
  • 8,095
1 vote
0 answers
48 views

Going through all the cases in a rule list

So, I want to have explainable equations derived from replacement rules. I made a Mathematica function that does the following, it takes a list of rules, and it applies them (using ReplaceAll), then ...
user avatar
  • 275
5 votes
2 answers
122 views

Customized priority function in DataStructure["PriorityQueue"]?

I'm using Mathematica 12.1. The documentation for DataStructure["PriorityQueue"] claims that, ... the highest-priority element is always returned. The ...
user avatar
  • 1,950
8 votes
2 answers
783 views

Best way to insert element into an ordered list at the correct position?

Suppose I have an ordered list orderedList and I want to write some code that will involve regularly inserting new elements into ...
user avatar
  • 699
0 votes
0 answers
106 views

Is a tree structure possible in Mathematica?

Let's say I have a vector, vector={1,2,3,4,5,6,7}; and I want to use its items as leaf nodes in a tree datasctructure, then work with them as such, adding new ...
user avatar
  • 63
1 vote
1 answer
71 views

A more efficient way to interrogate data inside a Dataset: a generic relational map

I have a Dataset that stores the relationships between people IDs (in columns) and the events they attended (in rows). I want to produce a linear text report of those relationships. How can I do this ...
user avatar
  • 163
17 votes
2 answers
384 views

How to determine if two mutable data structures are the same?

How can I determine if two mutable data structures (DataStructure) are truly the same? I do not mean checking if they have the same value. I mean checking if they ...
user avatar
  • 225k
16 votes
2 answers
449 views

How to use DataStructure in FunctionCompile?

The official document said compile a function that can work with data structures but how to use it? There is no doubt that it is possible to use DataStructure as a function parameter: ...
user avatar
  • 313
11 votes
1 answer
413 views

How to use the new DataStructure in V 12.1 as is done in classical struct?

There is new DataStructure in V 12.1. I thought at first it is similar to classical struct or record found in other languages and discussed in Struct equivalent in Mathematica? How to use classical ...
user avatar
  • 109k
14 votes
2 answers
743 views

COVID-19 Wolfram Data Repository Retrieval

I'm using this dataset to check out the data on new COVID-19 cases. But there are two issues: Two days ago it was working great and it had data up to March 13; 1 day lag. Now when I run the cell in ...
user avatar
  • 1,478
7 votes
1 answer
308 views

Implement abstract algebraic structure

I would like to implement algebraic structures in Mathematica such as groups, algebras, Lie-algebras, Hopf-algebras, ... In particular, after initialising such a structure, I would like to have ...
user avatar
  • 928
0 votes
1 answer
85 views

How to discritize a function domain (break xy-plane to a grid/mesh of squares with vertex values for evaluation)? [closed]

I wrote a code using MATLAB to discritize a function's 2D domain into squares/rectangles, whose vertex data (x,y) I can use to evaluate the function at. Then I sum these values over all vertices to ...
user avatar
2 votes
1 answer
51 views

How to increase the pointsize of the point-markers in the legend of a cluster-chart?

I start the following mock data set: data = RandomReal[{0, 700}, {10^4, 2}]; I use k to define the number of cluster points: ...
user avatar
1 vote
1 answer
49 views

How to view data labels corresponding to cluster points when using FindClusters and Tooltip?

I go straight to the subject; I have the following data set: ...
user avatar
3 votes
2 answers
109 views

Format table output

I'm trying to make a quick code to give me coordinates of some circles to be read in AUTOCAD. When I use the format "Table" or ...
user avatar
6 votes
4 answers
335 views

Threading data on TimeSeries

Say I have two TimeSeries: x = TimeSeries[{2, 4, 1, 10}, {{1, 2, 4, 5}}] y = TimeSeries[{6, 2, 6, 3, 9}, {{1, 2, 3, 4, 5}}] x has a value at times: 1,2,4,5 y ...
user avatar
  • 145
7 votes
2 answers
482 views

How to import .txt file with missing data?

I have a .txt file that looks like this (direct copy from the file): ...
user avatar
  • 23.2k
1 vote
1 answer
111 views

How to join N datasets with common headers?

I am new to Dataset. I'm trying to join many datasets, naively trying to use Join, but I think I'm not using it correctly, or ...
user avatar
  • 1,313
9 votes
1 answer
314 views

Most efficient method for export/import of non-traditional tensor-style dimensions of matrices/tables/lists-of-lists-of-lists(-of lists)?

Hello World! (I did it for my first answer, so it only feels proper...I'm not nostalgic, you are!) OKAY, here we go! Let's start off with the good-stuff, here's my code, made relatively arbitrary, ...
user avatar
11 votes
1 answer
246 views

Implementing core data structures

Data structures are your friend. Using the right data structure in the right place means better performance and less work on the programmer's part. This poses a problem in Mathematica, of course, ...
user avatar
  • 45.5k
6 votes
2 answers
871 views

Convert a huge txt-file into a dataset

My friend has this huge txt-log of sea levels. He wants to organize it into a dataset. After importing it this file a used StringSplit to separate it into rows, then to singular elements ...
user avatar
0 votes
1 answer
168 views

How can I translate some JavaScript code into Mathematica code? [closed]

I am a programmer and would like to understand another field outside of the procedural thinking of if-else and for. I would like ...
user avatar
13 votes
1 answer
818 views

Pascal records and Mathematica programming

Background: "experienced" Pascal-programmer (DOS-era, never got into OOP) proud owner of Mathematica ver 11.2 have used Mathematica for years to do my share of number crunching and plotting to ...
user avatar
13 votes
6 answers
266 views

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

I have an arbitrary ragged nested list-of-lists (a tree) like A = {{a, b}, {c, d}, {{{e, f, g, h, i}, {j, k, l}}, m}, n}; Its structure is given by the rules <...
user avatar
  • 36.2k
4 votes
2 answers
583 views

Converting from "matrix" data into "coordinate" data

Say I have data which looks like data1 - this is "matrix" like data (is there a better descriptor?). The data looks like a matrix, and at each point in the matrix, ...
user avatar
  • 3,862
3 votes
0 answers
203 views

Approximate Nearest Neighbors in Mathematica?

Is there any support for Approximate Nearest Neighbors (ANN) in Mathematica or third-party packages? I'm looking for a good implementation of locality sensitive hashing for applications where ...
user avatar
  • 30.4k
3 votes
1 answer
80 views

What's the best way to import such dataset?

https://www.ocr.org.uk/Images/400305-large-data-set-lds_1-h630-2018-h640-2018-2019-pre-release-data-mei.xlsx What's the best way to import such dataset? I have tried to use ...
user avatar
  • 1,252
15 votes
1 answer
247 views

Substitute for Association inside Compile?

Associations are not compilable, so I’m looking for a workaround to this. That is, I need a mutable hashtable-like data structure with fast key value lookups ...
user avatar
  • 30.4k
4 votes
1 answer
133 views

Local Storage of Periodically Collected Data (without using DataDrop)

I would like to take periodic measurements (e.g. noise levels and temperature in my office from a Raspberry Pi, etc.), say, every minute and have a long-reaching record of this similar to Stephen's ...
user avatar
  • 1,117
10 votes
1 answer
866 views

Tree-like data sets with efficient storage and retrieval

Most probably this is going to be a duplicate, sorry. I found too many questions/answers here about tree-like structures, and still could not locate what I want. It is a followup of my previous ...
user avatar
14 votes
1 answer
267 views

Data re-structuring by Thread

Thread can do this Thread[{a, {b, c, d}}] {{a, b}, {a, c}, {a, d}} But when above ...
user avatar