How do I load read only the two number columns skipping headerlines using dlmread?

1 view (last 30 days)
This is the file:
UK SOFT
software UK2002S 5.3.3
FileVersion 7
op_mode SPECTROSCOPY
Microscp_type 1
z_v_to_angs 38.000000
max_z_volt 215.000000
convers_coeff 1.000000
Parameter_11 100.000000
Parameter_22 10.000000
profile_name AFM force vs distance spectroscopy
date 01.01.2002
time 02:35:01
iv_sub_mode 0
cycle_preset 5
averaging_mode0
num_format 0
mult_sweep TRUE
iv_log_scale FALSE
output_low -300.000000
output_high 817.000000
out_dspl_low -245.099991
out_dspl_high 817.000000
input_low -10.000000
input_high 5.440000
user_channels 2048
data_channels 2000
pre_sweep_dly 10
smooth_fctr 4
input_limit 0.000000
iv_out_value 1053.789429
dwell_time 1.000000
output1_value 1053.789429
output2_value 0.000000
output3_value 0.000000
accu_factor_0 0.100000
accu_factor_1 0.900000
y_gain 1.000000
fixed_index -1
sweep_index 1
sweep_dir 5
cursor_channel2 10 20
baseline_ch 2 10 20
sweep_arg_1 100.000000
sweep_arg_2 5.000000
file_incr TRUE
auto_save TRUE
store_all FALSE
store_aux FALSE
ch3_enabled FALSE
split_plot_id 0
ascii_format TRUE
buffer_incr FALSE
overlay FALSE
overlay_mode 1867
nr_overlay_buf2
simult_scale FALSE
link_scale TRUE
AdjXAllPlots FALSE
toggle_sweep FALSE
draw_grid FALSE
connect_line 1
zero_interval 0.000000
baseline_rel FALSE
baserel_cursorFALSE
sweep_arg_0 0.000000
deltaFenabled FALSE
IVservo_on FALSE
IntegrateOn FALSE
pulse_length_s1.000000
pulse_ampl 0.000000
pulse_ampl2 0.000000
pulse_ampl3 0.000000
active_cursor FALSE
comments comments
ylogaxis 0 0
input_low_log 0 0.100000
input_hi_log 0 100.000000
aux_input_id 1
aux_input_lo -10.000000
aux_input_hi 10.000000
aux_displ_lo -630.268188
aux_displ_hi 710.596497
ylogaxis 1 0
input_low_log 1 0.100000
input_hi_log 1 100.000000
ch3_input_id 2
ch3_input_lo -10.000000
ch3_input_hi 10.000000
ch3_displ_lo -630.268188
ch3_displ_hi 710.596497
ylogaxis 2 0
input_low_log 2 0.100000
input_hi_log 2 100.000000
first_channel 0
buffer_id 0
filename ra1001
assoc_imid_ole0.000000
assoc_image_n filename
acq_tip_pos_x 128
acq_tip_pos_y 128
lb tip pos x -1
lb tip pos y 213
BiasAppliedTo 0
data 2000
8.170000e+002 -1.574707e+000 «
8.158824e+002 -1.575012e+000 «
8.147649e+002 -1.575928e+000 «
8.136473e+002 -1.575928e+000 «
8.125298e+002 -1.575317e+000 «
8.114122e+002 -1.575012e+000 «
8.102946e+002 -1.575928e+000 «
8.091771e+002 -1.575623e+000 «
8.080595e+002 -1.575928e+000 «
8.069420e+002 -1.575317e+000 «
8.058244e+002 -1.575928e+000 «
8.047068e+002 -1.575928e+000 «
8.035893e+002 -1.576538e+000 «
8.024717e+002 -1.576538e+000 «
8.013542e+002 -1.576538e+000 «
8.002366e+002 -1.576538e+000 «
7.991191e+002 -1.578064e+000 «
7.980015e+002 -1.578064e+000 «
7.968839e+002 -1.578369e+000 «
7.957664e+002 -1.578369e+000 «
7.946488e+002 -1.577148e+000 «
7.935313e+002 -1.577759e+000 «
7.924137e+002 -1.578369e+000 «
7.912961e+002 -1.577759e+000 «
7.901786e+002 -1.578674e+000 «
7.890610e+002 -1.578064e+000 «
7.879435e+002 -1.578979e+000 «
7.868259e+002 -1.578979e+000 «
7.857084e+002 -1.580505e+000 «
7.845908e+002 -1.579285e+000 «
7.834732e+002 -1.578979e+000 «
7.823557e+002 -1.578369e+000 «
7.812381e+002 -1.579895e+000 «
7.801205e+002 -1.579285e+000 «
7.790030e+002 -1.578979e+000 «
7.778854e+002 -1.578369e+000 «
7.767679e+002 -1.578979e+000 «
7.756503e+002 -1.580811e+000 «
7.745328e+002 -1.580505e+000 «
7.734152e+002 -1.581421e+000 «
7.722977e+002 -1.580505e+000 «
7.711801e+002 -1.580811e+000 «
7.700625e+002 -1.580505e+000 «
7.689449e+002 -1.581421e+000 «
7.678274e+002 -1.581116e+000 «
7.667098e+002 -1.579895e+000 «
7.655923e+002 -1.580505e+000 «
7.644747e+002 -1.581116e+000 «
7.633572e+002 -1.579895e+000 «
7.622396e+002 -1.580811e+000 «
7.611221e+002 -1.581116e+000 «
7.600045e+002 -1.581421e+000 «
7.588870e+002 -1.581421e+000 «
7.577694e+002 -1.581726e+000 «
7.566518e+002 -1.583252e+000 «
7.555342e+002 -1.582336e+000 «
7.544167e+002 -1.581726e+000 «
7.532991e+002 -1.584473e+000 «
7.521816e+002 -1.583862e+000 «
7.510640e+002 -1.584473e+000 «
7.499465e+002 -1.583557e+000 «
7.488289e+002 -1.584167e+000 «
7.477114e+002 -1.583862e+000 «
7.465938e+002 -1.583862e+000 «
7.454763e+002 -1.584473e+000 «
7.443587e+002 -1.583862e+000 «
7.432411e+002 -1.582947e+000 «
7.421235e+002 -1.584473e+000 «
7.410060e+002 -1.583557e+000 «
7.398884e+002 -1.583862e+000 «
7.387709e+002 -1.584473e+000 «
7.376533e+002 -1.585083e+000 «
7.365358e+002 -1.584473e+000 «
7.354182e+002 -1.585083e+000 «
7.343007e+002 -1.584167e+000 «
7.331831e+002 -1.584778e+000 «
7.320656e+002 -1.582947e+000 «
7.309480e+002 -1.585083e+000 «
7.298304e+002 -1.585388e+000 «
7.287128e+002 -1.585999e+000 «
7.275953e+002 -1.585388e+000 «
7.264777e+002 -1.585388e+000 «
7.253602e+002 -1.585693e+000 «
7.242426e+002 -1.585083e+000 «
7.231251e+002 -1.585388e+000 «
7.220075e+002 -1.586304e+000 «
7.208900e+002 -1.585693e+000 «
7.197724e+002 -1.585999e+000 «
7.186548e+002 -1.586914e+000 «
7.175373e+002 -1.585083e+000 «
7.164197e+002 -1.586304e+000 «
7.153021e+002 -1.586304e+000 «
7.141846e+002 -1.586609e+000 «
7.130670e+002 -1.587219e+000 «
7.119495e+002 -1.587219e+000 «
7.108319e+002 -1.585388e+000 «
7.097144e+002 -1.585999e+000 «
7.085968e+002 -1.587524e+000 «
7.074792e+002 -1.587830e+000 «
7.063617e+002 -1.588440e+000 «
7.052441e+002 -1.587830e+000 «
7.041266e+002 -1.587219e+000 «
7.030090e+002 -1.588440e+000 «
7.018914e+002 -1.587219e+000 «
7.007739e+002 -1.588135e+000 «
6.996563e+002 -1.588745e+000 «
6.985388e+002 -1.587830e+000 «
6.974212e+002 -1.588745e+000 «
6.963036e+002 -1.588135e+000 «
6.951861e+002 -1.587830e+000 «
6.940685e+002 -1.589050e+000 «
6.929510e+002 -1.589355e+000 «
6.918334e+002 -1.589966e+000 «
6.907159e+002 -1.589050e+000 «
6.895983e+002 -1.590271e+000 «
6.884807e+002 -1.589355e+000 «
6.873632e+002 -1.588745e+000 «
6.862456e+002 -1.588440e+000 «
6.851281e+002 -1.589966e+000 «
6.840105e+002 -1.589355e+000 «
6.828929e+002 -1.589355e+000 «
6.817754e+002 -1.588745e+000 «
6.806578e+002 -1.588745e+000 «
6.795403e+002 -1.590271e+000 «
6.784227e+002 -1.590271e+000 «
6.773052e+002 -1.590576e+000 «
6.761876e+002 -1.590576e+000 «
6.750700e+002 -1.590881e+000 «
6.739525e+002 -1.589966e+000 «
6.728349e+002 -1.590576e+000 «
6.717173e+002 -1.590881e+000 «
6.705998e+002 -1.591187e+000 «
6.694822e+002 -1.589966e+000 «
6.683647e+002 -1.590881e+000 «
6.672471e+002 -1.592102e+000 «
6.661296e+002 -1.591187e+000 «
6.650120e+002 -1.591187e+000 «
6.638944e+002 -1.592407e+000 «
6.627769e+002 -1.591797e+000 «
6.616593e+002 -1.591187e+000 «
6.605417e+002 -1.593628e+000 «
6.594242e+002 -1.593628e+000 «
6.583066e+002 -1.593628e+000 «
6.571891e+002 -1.593933e+000 «
6.560715e+002 -1.593628e+000 «
6.549540e+002 -1.593018e+000 «
6.538364e+002 -1.593323e+000 «
6.527189e+002 -1.593323e+000 «
6.516013e+002 -1.592407e+000 «
6.504837e+002 -1.591797e+000 «
6.493661e+002 -1.592712e+000 «
6.482486e+002 -1.593018e+000 «
6.471310e+002 -1.593933e+000 «
6.460135e+002 -1.593628e+000 «
6.448959e+002 -1.594238e+000 «
6.437784e+002 -1.593933e+000 «
6.426608e+002 -1.594543e+000 «
6.415433e+002 -1.594543e+000 «
6.404257e+002 -1.593933e+000 «
6.393082e+002 -1.593933e+000 «
6.381906e+002 -1.594543e+000 «
6.370730e+002 -1.594543e+000 «
6.359554e+002 -1.593323e+000 «
6.348379e+002 -1.593933e+000 «
6.337203e+002 -1.594543e+000 «
6.326028e+002 -1.595154e+000 «
6.314852e+002 -1.595764e+000 «
6.303677e+002 -1.595154e+000 «
6.292501e+002 -1.595764e+000 «
6.281326e+002 -1.595459e+000 «
6.270150e+002 -1.594543e+000 «
6.258975e+002 -1.595459e+000 «
6.247799e+002 -1.593628e+000 «
6.236623e+002 -1.595764e+000 «
6.225447e+002 -1.595154e+000 «
6.214272e+002 -1.595459e+000 «
6.203096e+002 -1.595459e+000 «
6.191921e+002 -1.595154e+000 «
6.180745e+002 -1.595459e+000 «
6.169570e+002 -1.595154e+000 «
6.158394e+002 -1.595764e+000 «
6.147219e+002 -1.596069e+000 «
6.136043e+002 -1.596985e+000 «
6.124868e+002 -1.597290e+000 «
6.113692e+002 -1.597900e+000 «
6.102516e+002 -1.598206e+000 «
6.091340e+002 -1.597900e+000 «
6.080165e+002 -1.596985e+000 «
6.068989e+002 -1.598511e+000 «
6.057814e+002 -1.598206e+000 «
6.046638e+002 -1.597900e+000 «
6.035463e+002 -1.599426e+000 «
6.024287e+002 -1.599121e+000 «
6.013112e+002 -1.597900e+000 «
6.001936e+002 -1.597290e+000 «
5.990760e+002 -1.599121e+000 «
5.979585e+002 -1.598816e+000 «
5.968409e+002 -1.598816e+000 «
5.957233e+002 -1.599426e+000 «
5.946058e+002 -1.599121e+000 «
5.934882e+002 -1.600342e+000 «
5.923707e+002 -1.598816e+000 «
5.912531e+002 -1.599426e+000 «
5.901356e+002 -1.599426e+000 «
5.890180e+002 -1.599426e+000 «
5.879005e+002 -1.599731e+000 «
5.867829e+002 -1.600342e+000 «
5.856653e+002 -1.600647e+000 «
5.845478e+002 -1.600342e+000 «
5.834302e+002 -1.600952e+000 «
5.823126e+002 -1.599121e+000 «
5.811951e+002 -1.600037e+000 «
5.800775e+002 -1.600647e+000 «
5.789600e+002 -1.600647e+000 «
5.778424e+002 -1.600342e+000 «
5.767249e+002 -1.599731e+000 «
5.756073e+002 -1.600952e+000 «
5.744897e+002 -1.601868e+000 «
5.733722e+002 -1.601868e+000 «
5.722546e+002 -1.600342e+000 «
5.711371e+002 -1.601257e+000 «
5.700195e+002 -1.602173e+000 «
5.689019e+002 -1.602478e+000 «
5.677844e+002 -1.602173e+000 «
5.666668e+002 -1.602783e+000 «
5.655493e+002 -1.603394e+000 «
5.644317e+002 -1.603699e+000 «
5.633141e+002 -1.603394e+000 «
5.621966e+002 -1.604614e+000 «
5.610790e+002 -1.603088e+000 «
5.599615e+002 -1.604309e+000 «
5.588439e+002 -1.604004e+000 «
5.577264e+002 -1.604614e+000 «
5.566088e+002 -1.604309e+000 «
5.554912e+002 -1.605530e+000 «
5.543737e+002 -1.604309e+000 «
5.532561e+002 -1.604004e+000 «
5.521385e+002 -1.604309e+000 «
5.510210e+002 -1.604919e+000 «
5.499034e+002 -1.604919e+000 «
5.487859e+002 -1.604919e+000 «
5.476683e+002 -1.604919e+000 «
5.465508e+002 -1.604004e+000 «
5.454332e+002 -1.604004e+000 «
5.443157e+002 -1.603699e+000 «
5.431981e+002 -1.606445e+000 «
5.420805e+002 -1.605530e+000 «
5.409630e+002 -1.604919e+000 «
5.398454e+002 -1.606445e+000 «
5.387278e+002 -1.604919e+000 «
5.376103e+002 -1.605530e+000 «
5.364927e+002 -1.606445e+000 «
5.353752e+002 -1.606140e+000 «
5.342576e+002 -1.605225e+000 «
5.331401e+002 -1.606445e+000 «
5.320225e+002 -1.607971e+000 «
5.309049e+002 -1.606750e+000 «
5.297874e+002 -1.607361e+000 «
5.286698e+002 -1.606750e+000 «
5.275522e+002 -1.607666e+000 «
5.264347e+002 -1.607666e+000 «
5.253171e+002 -1.608582e+000 «
5.241996e+002 -1.607971e+000 «
5.230820e+002 -1.609497e+000 «
5.219645e+002 -1.608276e+000 «
5.208469e+002 -1.608276e+000 «
5.197294e+002 -1.609192e+000 «
5.186118e+002 -1.609497e+000 «
5.174942e+002 -1.608582e+000 «
5.163766e+002 -1.608276e+000 «
5.152591e+002 -1.608276e+000 «
5.141415e+002 -1.609497e+000 «
5.130240e+002 -1.608887e+000 «
5.119064e+002 -1.610413e+000 «
5.107889e+002 -1.610107e+000 «
5.096713e+002 -1.611023e+000 «
5.085538e+002 -1.610107e+000 «
5.074362e+002 -1.609497e+000 «
When I run this program:
for k = 1001:1002; data{k} = dlmread(sprintf('ra%d.ivs',k),'',105,3); end
It gives the following error: Index exceeds matrix dimensions. and when I change the program to:
for k = 1001:1002;
data{k} = dlmread(sprintf('ra%d.ivs',k),'',105,0);
end
It gives the error,
Error using dlmread (line 139)
Mismatch between file and format string.
Trouble reading number from file (row 1u, field 3u) ==> «\n
Any help would be much appreciated. Thanks in advance for your response.

Accepted Answer

Walter Roberson
Walter Roberson on 20 Sep 2016
In versions before R2015a or so (we are not sure exactly which version), it was not possible to use dlmread() for any file that contained text anywhere, even if you were passing parameters that asked for the lines to be skipped.
In newer versions, dlmread() can be used with files that contain text in the header lines that you skip, but not text anywhere else (or possibly text in leading columns you ask to skip might also be okay.)
Your file cannot be handled by dlmread at all, because it contains the text character '«' after numeric columns to be read.
You should be switching to using textscan with 'HeaderLines', 104, and with format '%f%f%*s'

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!