Print Data Folder content to Command Line

//The function prints all the waves , variables and strings (including their data) in a data folder in a  format which may allow easy replication
Function PrintDataFolderList()
    killwaves/z TempWave,TempWaveTxt
    //gets the waves first
    string ThisWave="test",data="",waves=WaveList("*",";","")
    variable objects
    for (objects=0;objects<itemsinlist( waves);objects+=1)
        ThisWave=stringfromlist(objects,waves)
        if(wavetype($ThisWave,1)==1)//numeric
            duplicate /o $ThisWave, TempWave
            data="make/o /n=("+num2str(dimsize($ThisWave,0))+","+num2str(dimsize($ThisWave,1))+") "+ThisWave+"={"
        else           
            duplicate/t /o $ThisWave, TempWaveTxt
            data="make/o/t /n=("+num2str(dimsize($ThisWave,0))+","+num2str(dimsize($ThisWave,1))+") "+ThisWave+"={"
        endif  
        variable i,j
        if(dimsize($ThisWave,1)>0)
            for (j=0;j<dimsize($ThisWave,1);j+=1)
                data+="{"
                for (i=0;i<dimsize($ThisWave,0);i+=1)
                    if(wavetype($ThisWave,1)==01)//numeric
                        data+=num2str(TempWave[i][j])
                    else
                        data+="\""+TempWaveTxt[i][j]+"\""
                    endif
                    if(i<dimsize($ThisWave,0)-1)
                        data+=","
                    endif
                endfor 
                data+="}," 
            endfor
        else
            for (i=0;i<dimsize($ThisWave,0);i+=1)          
                if(wavetype($ThisWave,1)==01)//numeric
                    data+=num2str(TempWave[i])+","
                else
                    data+="\""+(TempWaveTxt[i])+"\","
                endif
            endfor 
        endif  
        data=removeending(data)+"}"
        print data
    endfor
    killwaves/z TempWave,TempWaveTxt
    //gets the variables
    for (objects=0;objects<CountObjects("", 2 );objects+=1)
        execute "print \"variable/g "+GetIndexedObjName("", 2, objects )+"=\","+GetIndexedObjName("", 2, objects )
    endfor
    //gets the strings
    for (objects=0;objects<CountObjects("", 3 );objects+=1)
        execute "print \"string/g "+GetIndexedObjName("", 3, objects )+"=\","+GetIndexedObjName("", 3, objects )
    endfor 
end

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More