GithubHelp home page GithubHelp logo

fagan2888 / data-6 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sg-s/data

0.0 1.0 0.0 30 KB

[experimental] MATLAB class to make working with datasets of any size a pleasure

License: GNU General Public License v3.0

MATLAB 99.40% Objective-C 0.60%

data-6's Introduction

data

data is an experimental MATLAB class to make it easier to work with datasets.

The problem

Existing tools in MATLAB are underwhelming (like struct or table). If you have a bunch of data that comes from a large number of conditions, you have the following options:

Store things in a N-D array

  • but what if you have missing data?
  • thinking in N dimensions is hard
  • 50% of your code is now the squeeze function
  • Your data isn't probably a hyper-cube, so this is wasteful

Store things in 2D arrays, and logically index

  • This is the accepted best-practice in scientific computing
  • But it has its own problems: either you have a bunch of matrices that should be the same size, or you put everything in a structure
  • It's easy to make mistakes and accidentally resize one matrix, but not the rest
  • Its hard to filter the entire dataset, even though all the information you need is right there

The solution

Enter data.

It's a simple MATLAB class that creates a structure with the following rigid limitations:

  1. Only 1D and 2D arrays allowed
  2. All arrays must be the same size. This makes it much harder to screw up in indexing arrays

In addition, data, comes with a number of helpful methods to make working with large datasets easier.

Usage

Create a new Data object

% S is a structure
d = Data(S);

You can also create a new Data object with some variables and specify their dimensions:

d = Data('X',8,'Y',8);

Save to disk:

d.save

Append a new Data structure to an old one

d + d_new

Note that this overloaded operation is not commutative: what this does is to take the contents of d_new and append it to d. So d will be changed, but d_new will not be.

Note that you don't have to assign this to a variable:

d = d + d_new % no needed, same as
d + d_new     % this line 

Combine a whole bunch of Data files into one

d.consolidate()

Often, you end up with your data split up into mulitple files when they should be in one file (this is true for both experiments and simualations). This handy consolidate method combines them all into one file and deletes the fragmented pieces.

Filter data based on a logical operator

If you have a large amount of data in your Data object, you can create a new Data object based on some logical filter:

d2 = d.filter(d.X>0);

License

GPL v3

data-6's People

Contributors

sg-s avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.