lifeontilt Posted December 3, 2008 Share Posted December 3, 2008 The system I work with generates multiple text files. Below is a sample of what the file looks like. They follow the same format. Only the values of the variable change from file to file. There is a lot of Meta-Data (Junk as far as im concerned) in the beginning which I don't need. I only want to read the last two variables at the very end of the file. And plot them on a graph. X axis would be time, Y would be intensity. Time is defined by second last variable in the file "actual_sampling_interval" Pretty self explanatory, X increases in this increment. Y should be the "ordinate_values" (the very last array). Im really frustrate about this, any level of help would be really nice. A snipped that extracts info I need and makes a variable and array in PHP/Perl would be really nice. Ive looked at many PHP charting scripts... Once I have the variable/array in PHP, it should be fairly easy to just plug in data into a charting script. THANKS ALOT! netcdf sig { dimensions: _2_byte_string = 2 ; _4_byte_string = 4 ; _8_byte_string = 8 ; _16_byte_string = 16 ; _32_byte_string = 32 ; _64_byte_string = 64 ; _255_byte_string = 255 ; point_number = 2778 ; peak_number = UNLIMITED ; // (0 currently) error_number = 1 ; variables: float detector_maximum_value ; float detector_minimum_value ; float actual_run_time_length ; float actual_delay_time ; float actual_sampling_interval ; float ordinate_values(point_number) ; ordinate_values:uniform_sampling_flag = "Y" ; ordinate_values:autosampler_position = "42884288" ; float peak_retention_time(peak_number) ; float peak_start_time(peak_number) ; float peak_end_time(peak_number) ; float peak_width(peak_number) ; float peak_area(peak_number) ; float peak_area_percent(peak_number) ; float peak_height(peak_number) ; float peak_height_percent(peak_number) ; float peak_asymmetry(peak_number) ; float baseline_start_time(peak_number) ; float baseline_start_value(peak_number) ; float baseline_stop_time(peak_number) ; float baseline_stop_value(peak_number) ; char peak_start_detection_code(peak_number, _2_byte_string) ; char peak_stop_detection_code(peak_number, _2_byte_string) ; float migration_time(peak_number) ; float peak_area_square_root(peak_number) ; short manually_reintegrated_peaks(peak_number) ; // global attributes: :dataset_completeness = "C1+C2" ; :aia_template_revision = "1.0" ; :netcdf_revision = "2.3" ; :languages = "English only" ; :injection_date_time_stamp = "20061120113104+0000" ; :HP_injection_time = "20-Nov-08, 11:31:04" ; :experiment_title = "SequenceLine: 5 Inj: 1" ; :operator_name = "SFong" ; :separation_experiment_type = "blah blah " ; :source_file_reference = "C:\\arb\\1\\DATA\\10-20-2006\\1553_PC4SK9_2006-10-20\\1554 D01.D" ; :sample_name = "1553 D01" ; :sample_id = "" ; :detector_unit = "LU " ; :detection_method_name = "HTPP_SAMPLE.M" ; :detector_name = "FLD1 A, Ex=280, Em=350" ; :retention_unit = "seconds" ; data: detector_maximum_value = 3.8252 ; detector_minimum_value = 1.54227 ; actual_run_time_length = 1199.664 ; actual_delay_time = 0 ; actual_sampling_interval = 0.432 ; ordinate_values = 1.8, 1.9, 1.9, 1.5, 1.3, 1.5, 1.5, 1.8, 1.5, 1.6, 1.3, 1.2, 1.9, 1.6, 1.4, 1.4, 1.6, 1.7, 1.877654, 1.874763, 1.872027, 1.869702, 1.86798, 1.866966, 1.866651, 1.866943, 1.867735, 1.868904, 1.870334, 1.871884, 1.87338, 1.874685, 1.875782, 1.713794 ; } Link to comment https://forums.phpfreaks.com/topic/135410-need-to-extract-data-from-flat-files-and-plot-it/ Share on other sites More sharing options...
.josh Posted December 3, 2008 Share Posted December 3, 2008 so from that example file, you need the stuff in red? ordinate_values = 1.8, 1.9, 1.9, 1.5, 1.3, 1.5, 1.5, 1.8, 1.5, 1.6, 1.3, 1.2, 1.9, 1.6, 1.4, 1.4, 1.6, 1.7, 1.877654, 1.874763, 1.872027, 1.869702, 1.86798, 1.866966, 1.866651, 1.866943, 1.867735, 1.868904, 1.870334, 1.871884, 1.87338, 1.874685, 1.875782, 1.713794 ; } edit: oops my bad, didn't read close enough. Link to comment https://forums.phpfreaks.com/topic/135410-need-to-extract-data-from-flat-files-and-plot-it/#findComment-705311 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.