Home > NoiseTools > nt_unfold.m

# nt_unfold

## PURPOSE

y=nt_fold(x) - unfold 3D to 2D

## SYNOPSIS

function x=nt_unfold(x)

## DESCRIPTION

    y=nt_fold(x) - unfold 3D to 2D

      y: 2D matrix of concatentated data (time * channel)

      x: 3D matrix of (time * channel * trial)

     NoiseTools

## CROSS-REFERENCE INFORMATION

This function calls:

- nt_greetings nt_greetings - display message the first time the toolbox is used

This function is called by:

- nt_cov2 [c,tw]=nt_cov2(x,w) - weighted covariance
- nt_demean [y,mn]=nt_demean(x,w) - remove weighted mean over cols
- nt_dss_repeat_cluster y=nt_dss_repeat_cluster(x,nkeep,cluster_size) - dss within clusters
- nt_fixsign y=nt_fixsign(x) - flip signs to maximize inter-component correlation
- nt_growmask ww=nt_growmask(w,margin) - widen mask
- nt_mmat y=nt_mmat(x,m) - matrix multiplication (with convolution)
- nt_normcol [y,norm]=nt_normcol(x,w) - normalize each column so its weighted msq is 1
- nt_pca_kmeans [topcs,pwr]=nt_pca_kmeans(x,nkeep) - PCA preceded by kmeans for speed
- nt_regw [b,z]=nt_regw(y,x,w) - weighted regression
- nt_sns y=nt_sns(x,nneigbors,skip,w) - sensor noise suppression
- nt_sns1 y=nt_sns1(x,nneigbors,skip,w,threshold) - sensor noise suppression
- nt_sns_cluster y=nt_sns_cluster(x,nneigbors,cluster_size) - sensor noise suppression within clusters
- nt_star [y,w,ww]=nt_star(x,thresh,closest,depth) - sensor noise suppression
- nt_star2 [y,w,ww]=nt_star2(x,thresh,closest,w) - sensor noise suppression
- nt_tsregress [z,idx]=nt_tsregress(x,y,shifts,xw,yw,keep,threshold) - time-shift regression
- nt_tsxcov [c,tw]=nt_tsxcov(x,y,shifts,w) - cross-covariance of X and time-shifted Y
- nt_vecadd y=nt_vecadd(x,v) - add vector to all rows or columns of matrix
- nt_vecmult y=nt_vecmult(x,v) - multiply all rows or columns of matrix by vector
- nt_wpwr [y,tweight]=nt_wpwr(x,w) - weighted power
- nt_xcov [c,tw]=nt_xcov(x,y,shifts,w) - cross-covariance of X and time-shifted Y
- nt_xprod [y,ind]=nt_xprod(x,flag,dsratio,normrow_flag) - form all crossproducts
- nt_xprod2 [y,ind]=nt_xprod(x1,x2,dsratio) - form all crossproducts

## SOURCE CODE

    0001 function x=nt_unfold(x)
    0002 %y=nt_fold(x) - unfold 3D to 2D
    0003 %
    0004 %  y: 2D matrix of concatentated data (time * channel)
    0005 %
    0006 %  x: 3D matrix of (time * channel * trial)
    0007 %
    0008 % NoiseTools
    0009 nt_greetings;
    0010
    0011
    0012 if isempty(x)
    0013     x=[];
    0014 else
    0015     [m,n,p]=size(x);
    0016     if p>1;
    0017         x=reshape(permute(x,[1 3 2]), m*p,n);
    0018     else
    0019         x=x;
    0020     end
    0021 end