The image thumbnail

Ebola sauce Data Manipulation kit Data Manipulation Toolbox

By version 4.1.0 (293 KB) Ebola sauce
Provides a series of array extension manipulation method

17 Downloads

The Updated02 Aug 2021

The From making

View license on making

Ebola sauce MATLAB data manipulation toolkit, provide a series of MATLAB lacks built-in functions, but the commonly used enhancements

The objective of the release version number to followSemantic versionSpecification.Developers think that this is a good specification, and recommended to each developer to comply with this specification.

directory

All functions in this package in EbolaChan. DataManipulation namespace, the need to import before use.Using a namespace is a good habit, can effectively prevent naming conflicts, avoid unnecessary code hinting code interference.

The importEbolaChan. DataManipulation. *;
  • ArrayBuilder < handle (MATLAB): an array of accumulator
  • CorrelationMatrixSort: the rank correlation matrix, makes the high correlation between individuals close to each other as much as possible
  • DivideEquallyOnDimensionsIntoCellsAn array along multiple dimensions specified split into multiple cell as equal as possible
  • DelimitedStrings2Table: will read a list of the separator string in the first few fields as your table or schedule
  • EstimateMemoryCapacity: to assess the current free memory array can store many samples
  • IntegralSplit: as much as possible will be split into a large integer equal to the sum of multiple small integers
  • MainFrequency: to calculate the frequency of the signal
  • MaxSubsThe maximum and the coordinates: the returned array.
  • MeanSem: one-time efficiently calculate data along the dimension of the mean value and standard error.
  • MinSubsReturns an array of the minimum and the coordinates.
  • StructAggregateByFields: the structure of the accumulated operation performed each field, cumulative results in a scalar field in the same structure in return.
  • SuperCell2Mat: cell2mat upgrade version

ArrayBuilder < handle (MATLAB)

An array of accumulator

Accumulation of data to memory, often need to constantly accumulate array of problems, and MATLAB will be prompted to allocate memory.But if we can't know that there will be how many items before reading, pre-allocated will become a very dynamic task of trouble.This class to create a dimension of growth in this dimension can accumulate a built-in array.Users only need to Append can continuously, without having to consider the problem of memory allocation, this class will automatically optimize the memory management.

%Constructs an array along the dimension 1 accumulationAb=ArrayBuilder(1);%Repeat accumulateThe fora.=1:3Ab.Append(randi([09].randi([03]),3));The endAb.Harvest%Continue to accumulateThe fora.=1:3Ab.Append(randi([09].randi([03]),3));The endAb.Harvest% {Ans =8, 3, 4,8 2 90 8 11 1 85 August 31 June 5Ans =8, 3, 4,8 2 90 8 11 1 85 August 31 June 50 2 1/ / data randomly generated, may be different for every run%}

Structural parameters: BuildDimension uint8 (1, 1) = 1, accumulative dimension.The dimensions of an array of growth will continue to accumulate, other dimensions will be decided by the first Append, no longer change in the future.

Read-only property

BuildDimension uint8 (1, 1), cumulative dimension

Members of the method

Append

Accumulate new content to the array

The content of the input parameters: the New, to accumulate.Can accumulate any content for the first time, after accumulation content can be inconsistent and for the first time on the accumulative dimension size, size of other dimensions must be consistent.

Harvest

Harvest accumulative arrays in MATLAB.Can release the object after harvest, also can continue to accumulate.

Return value: Array, accumulative arrays in MATLAB.

The Clear

Empty storage, from scratch to accumulate without new objects to allocate memory, with high performance.

CorrelationMatrixSort

In sorting, correlation matrix makes the high correlation between individuals close to each other as much as possible

Is a square matrix, correlation matrix can be obtained by corrcoef function, characterization of multidimensional data linear correlation between individuals.Correlation matrix on the main diagonal of all values are 1, says every individual associated with its absolute.Other value represents the Numbers for the value of the line and column of correlation between two individuals.Correlation matrix can be used as a heat map, but if the high correlation between individuals can't close to each other on the diagram into a group, it will be difficult to distinguish from related heat maps to the eye.So you need to prioritize, correlation matrix to be high correlation between individuals together as much as possible.

The load("CorrelationMatrix. Mat");tiledlayout("The flow", TileSpacing="tight"The Padding="tight");nexttile;imagesc(CorrelationMatrix);The title("unsorted");%Unsorted related heat maps, looks dazzling, it is hard to distinguish high related groupsnexttile;[SortIndex,SortedCM] =CorrelationMatrixSort(CorrelationMatrix);imagesc(SortedCM);The title("sorted");%After sorting, high related groups gathered together, and can display the order numberCB=colorbar;CB. Layout. Tile="east";SortIndex

The input parameters

CM (:, :), not sort of correlation matrix, must be square

The return value

SortedIndex (:, 1) double, sort Numbers, as individuals in the position of the original matrix for the index, namely SortedCM = SortedCM (SortIndex, SortIndex).

SortedCM (:, :), sorted matrix

DivideEquallyOnDimensionsIntoCells

Will an array along multiple dimensions specified split into multiple cell as equal as possible

> > DivideEquallyOnDimensionsIntoCells (rand (filling) 3, 2, 2) ans = 1 x 2 cell array {3 * 1 * 3 double} {3 * 2 * 3 double}

The input parameters

An Array of Array, want to break up

Dimensions (1, :) uint8, want to break up what dimension

NoDivisions (1, :) uint8, each dimension into several portions, sequence and Dimensions

The return value

After the splitting of Array cell, cell Array.If the dimension size is a multiple of that of the split points, equal to break up;If it's not The Times will be as equal as possible, each block size differ at most 1.

DelimitedStrings2Table

Will be a column delimiter string read the first few fields as your table or schedule

The separator string column following form:

4003.20210204. BlueBase. All. 10% 400 v_0002. Registered. Measurements. The mat 4003.20210204 BlueBase. PV. 10% 400 v_0002. Registered. Measurements. The mat 4003.20210204 GreenRef. All. 10% 400 v_0005. Registered. Measurements. The mat 4003.20210204 GreenRef. PV. 10% 400 v_0005. Registered. Measurements. The mat

Each row of a string, string divided into a series of field with a specific symbol.If the first few fields have a fixed meaning and exist in all of the string, they can be read into a table.If a field is the time, can also be read into the schedule.

Strings=["4003.20210204. BlueBase. All. 10% 400 v. _0002. Registered. Measurements. The mat""4003. The Registered. Measurements. 20210204. BlueBase. PV. 10% 400 v. _0002. Mat""4003.20210204. Measurements. GreenRef. All. 10% 400 v. _0005. Registered. Mat""Measurements. 4003. Registered. 20210204. GreenRef. PV. 10% 400 v. _0005. Mat"];%Ignore the "Registered" and "Measurements" two irrelevant keywords, the second field is always date, the other fields respectively have their meaning:The Table=DelimitedStrings2Table(Strings["The Mouse""Experiment""CellGroup""Condition""TrialNumber"].".", TimeField=2, IgnoreKeywords=["Registered""Measurements"])% {Table =4 x5 timetableThe Time the Mouse Experiment CellGroup Condition TrialNumberThe...... the... a _______ _______ _________The 2021-02-04 "4003" "BlueBase" "All" "10% of the 400 v" _0002 ""The 2021-02-04 "4003" "BlueBase" "PV" "10% of the 400 v" _0002 ""The 2021-02-04 "4003" "GreenRef" "All" "10% of the 400 v" _0005 ""The 2021-02-04 "4003" "GreenRef" "PV" "10% of the 400 v" _0005 ""%}

Required parameters

Strings (:, 1) string, separator string

FieldNames (1, :) string, start from scratch according to the order of the name of each field.If you have time fields or neglected key fields, skip, don't in the FieldNames instructions, also do not empty, but directly to the back of the field in advance.

Delimiter (1, 1) string, separator, will pass to the split for space.

Parameter name and value

TimeField uint8 (1, 1) = 0, time field in the string is which a field, neglected field is not included in the serial number.If set to 0, then there is no time field, return a list of common;Otherwise the return schedule.

= 'yyyyMMddHHmmss' DatetimeFormat (1, :) char, date/time format.Does not support contain delimiters date/time format, date time field string must be for all time number, such as "20210306", "202103061723", etc.If the actual field length is insufficient, will automatically be shortened the format string to match.Will serve as a datetime function InputFormat parameters.Time field between all string does not need to same length.If TimeField is 0, it will ignore the parameters.

IgnoreKeywords (1, :) string, if separated out of the field is certain keywords, ignore them, will not be read for the field, also do not count towards the location number.If time appeared in the neglected field, each have a neglected field, TimeField should be 1.

The return value

Table (:, :), if TimeField is 0, return to the Table, otherwise it returns a timetable.

EstimateMemoryCapacity

Assess current free memory array can store many samples

When handling files, for performance reasons, always hope to have the file of relief as far as possible all read into memory, after calculation of relief to write again, faster than random because the disk always order, speaking, reading and writing, speaking, reading and writing.But the file is bigger, can only support a limited memory block read, write, and some of the problems that will need to consider how each block.

Large files are usually the smallest unit of data can be read into a single, referred to as the data sheet.For example, video, a frame is a data sheet.This function can be obtained by the current system of free memory, calculate the current memory can carry many data, in order to help decision-making block size.

Input parameters: Sample, real array, a piece of Sample data

Double output parameters: Capacity (1, 1), the current memory can hold how many pieces of data

IntegralSplit

As much as possible will be split into a large integer equal to the sum of multiple small integers

> > IntegralSplit ans (10, 3) = 3, 3, 4, 3 x 1 uint8 column

The input parameters

The Sum (1, 1) uint8, want to break up large integer

The number of copies NoSplits uint8 (1, 1), split

The return value

Parts (:, 1) uint8, small integers, after the splitting of the and is equal to the big integer.If the Sum is a multiple of that of the NoSplits, these small integers is equal;Or at most 1.

MainFrequency

Calculate the frequency signal

Frequency is made after Fourier transform, the signal will be various frequency weighting average frequency of the resulting from the geometric average.

x=0.01:0.01:100;figure;holdon;%A typical high frequency signalYHigh=sin(x*10) *10+sin(x/10) /10;%The typical low frequency signalYLow=sin(x*10) /10+sin(x/10) *10;legend([The plot(x,YHigh)The plot(x,YLow)], [sprintf("Frequency % 2 g ㎐",MainFrequency(YHighThe SampleRate=100))sprintf("Frequency % 2 g ㎐",MainFrequency(YLowThe SampleRate=100)));xlabel("Time (s)");

Required parameters

Array Signal, Signal

Parameter name and value

Dimension (1, 1), calculate dimensions, the first Dimension of the default length is greater than 1

SampleRate (1, 1) = 1, the sampling rate

The return value

Mf, calculate the frequency dimensions.In calculating the array size dimension is 1, other dimensions and the same Signal.

MaxSubs

Returns an array of the maximum and the coordinates.

MATLAB with Max function can only return to multidimensional array maximum linear index.This breath returns the maximum and multidimensional coordinates, convenient and easy to use

%To have more than one maximum array, a linear index return the coordinates of the position:[The Value,S1,S2] =MaxSubs([991;144;989])% {Value =9S1 =1S2 =1%}

The input parameters

Multidimensional arrays of Data, to find the maximum

The return value

The Value (1, 1), the maximum Value

[S1, S2,..., Sn], the maximum position, linear index minimum the coordinates of the location.The coordinates of each return value, in turn, on behalf of all dimensions.

MeanSem

One-time efficiently calculate data along the dimension of mean value and standard error.

Specific algorithm: $$$$$$S = \ sum x Mean = \ frac {S} {N} $$$$SEM = \ frac {\ SQRT {\ sum \ {x} ^ 2 - S cdot Mean}} {N} $$

[Mean,SEM] =MeanSem([063;876;971].1)% {Mean =5.6667 6.6667 3.3333SEM =2.3254 0.2722 1.1863%}[Mean,SEM] =MeanSem([063;876;971])% {Mean =5.2222SEM =0.9910%}

The input parameters

The Data, the Data array

Dimensions, optional, aggregation dimension.Output scheme and SEM, and its Dimensions Dimensions of length 1, other Dimensions is the same as the Data length.By default, all dimensions where scheme and SEM for the global average and the standard error of scalar.

The return value

Mean double, along the dimensions of the average

SEM double, along the dimension of standard error

MinSubs

Returns an array of the minimum and the coordinates.

MATLAB own min function only returns the minimum value of linear multidimensional array index.The function of relief to return to the minimum and multi-dimensional coordinate, convenient and easy to use

%To have multiple minimum array, a linear index return the coordinates of the position:[The Value,S1,S2] =MinSubs([991;144;989])% {Value =1S1 =2S2 =1%}

The input parameters

The Data, to find the minimum of multidimensional arrays

The return value

The Value (1, 1), the minimum Value

[S1, S2,..., Sn], where the minimum value, the linear index minimum the coordinates of the location.The coordinates of each return value, in turn, on behalf of all dimensions.

StructAggregateByFields

Accumulated operation performed on the structure of each field, the cumulative results in a scalar field in the same structure in return.

a.(1). A=1;a.(1B).=2;a.(2). A=3;a.(2B).=4;B=StructAggregateByFields(@cell2mat,a.)

The input parameters

Function_handle AggregateFunction (1, 1), to perform a cumulative function, must accept a yuan and StructArray size same cell array input

StructArray struct, to accumulate the structure of the array

The return value

(1, 1) struct, and StructArray the same structure scalar fields, save the accumulation of each field operation result.

SuperCell2Mat

Cell2mat upgrade version

This function is the upgrade version of cell2mat, before use, please refer to the document cell2mat function, understand the functions and limitations.

Cell2mat MATLAB is a very powerful function, can be cell arrays of extracted, Mosaic a large array, and the size of the array of these don't have to be exactly the same, for example, can support the following joining together:

But it also has limitations.First of all, the only support numerical, logic, structure and characters of stitching, other common data types (string, cellular automata, class object) cannot be used.Secondly.For the following structure, although just the right size, but can't together:

This is because the cell2mat default spell 1 d first, size does not match the problems naturally.But we can see that, as long as the spell 2 d first, you can get 1 x 3 and 2 x 3 two matrices, and then 1 d can joining together.This function not only support a variety of data types, it will automatically try to joining together from different dimensions, thus to support more complex structures.

Input parameters: the Cells cell, joining together the cellular arrays, each cell contains consistent array data types, and on the various dimensions just can joining together into one large array, any dimension.

The return value: the stitching good large arrays

Cite the As

Ebola sauce (2022).Ebola sauce Data Manipulation kit Data Manipulation Toolbox(https://github.com/Silver-Fang/EbolaChansDataManipulationToolbox/releases/tag/v4.1.0), making. Retrieved.

MATLAB Release Compatibility
Created with R2021a
Compatible with R2021a and later releases
Platform Compatibility
Windows macOS Linux
TagsAdd Tags

The Community Treasure Hunt

Find the treasures in the MATLAB Central and discover how the community can help you!

Start Hunting!

+ EbolaChan / + DataManipulation

To view the or report issues in this lot add - on, visit theMaking the Repository.
To view the or report issues in this lot add - on, visit theMaking the Repository.