./
pp_structtransp.pro
Routines
top source pp_structtransp
result = pp_structtransp(strin)
Given a structure of arrays, creates its transpose (an array of structures). Useful for the output of read_csv and read_ascii, to make a structure array where each element is a row of the table (see example below).
Return value
An array of structures, where the fields in each element have the values from the corresponding element of the same fields in the input structure (see eaxmple below).
Parameters
- strin in required
The structure to be transposed. See example below.
Examples
Read the contents of IDL's example csv file and transpose them:
c=read_csv_pp(file_which('ScatterplotData.csv'),n_table_header=1)
help,c
;** Structure <edac6838>, 3 tags, length=3080, data length=3080, refs=1:
;DISTANCE_FROM_TERMINUS__METERS_ LONG Array[154]
;MEAN_PARTICLE_SIZE__MM_ DOUBLE Array[154]
;SEDIMENTATION_RATE__G_CM2YR_ DOUBLE Array[154]
help,pp_structtransp(c)
;<Expression> STRUCT = -> <Anonymous> Array[154]
help,(pp_structtransp(c))[0]
;** Structure <ec40f7f8>, 3 tags, length=24, data length=20, refs=1:
;DISTANCE_FROM_TERMINUS__METERS_ LONG 0
;MEAN_PARTICLE_SIZE__MM_ DOUBLE 0.062000000
;SEDIMENTATION_RATE__G_CM2YR_ DOUBLE 32.500000
Author information
- Author:
Paulo Penteado (http://www.ppenteado.net), Feb/2013
Statistics
Lines: | 15 lines |
Cyclomatic complexity: | 3 |
Modified cyclomatic complexity: | 3 |
File attributes
Modification date: | Wed Jun 29 22:15:28 2016 |
Lines: | 15 |
Docformat: | rst rst |