Discussion:
How can i read quickly export files from ADAMS Car
(too old to reply)
Leonidas Kalalis
2005-10-15 16:58:06 UTC
Permalink
I want to read the data from Adams Car which are exported in a very
stupid way and it takes me much time to erase all strings and
breaking all columns into the same height:

A. .BrakingVehicle_1.CF_0IN_50_cf.REQ_TIME (sec)
B. .BrakingVehicle_1.CF_0IN_50_cf.handling_output.ay (NO UNITS)
C. .BrakingVehicle_1.CF_0IN_50_cf.handling_output.beta (deg)
D. .BrakingVehicle_1.CF_0IN_50_cf.handling_output.vel (NO UNITS)
E.
.BrakingVehicle_1.CF_0IN_50_cf.steering_data.steering_wheel_angle_fron
t (deg)

A B C D
E
0.000000E+000 -2.044090E-004 3.303738E-004 5.000000E+001
0.000000E+000
1.000000E-002 6.096020E-003 2.134812E-003
4.999830E+001 0.000000E+000

If the export data are more than five variables Adams puts them under
the previous 5 columns mentioning also the same strings as above in
the example.

Is there someone who experienced the same problem?
How can i read my data quickly?
Jeremy Smith
2005-10-15 19:28:52 UTC
Permalink
The function takes in the file name as a string and outputs the five
variables. Change values as needed.

Example of usage:
[A B C D E] = CLeanAdam('AdamsCar_1.txt')

Assumptions:
1. There are 10 lines before the data beings.
2. From where the data begins to the end of the file there is
only data and no further text.

function [A B C D E] = CleanAdam(Filename)

fid = fopen(Filename); % Open the file

HL = 10; % Header Lines before the data begins

% Skip the lines before the data begins
for i=1:1:HL
x = fgetl(fid);
end

% Store data in a 1xn char array
Data = [];
while feof(fid) == 0
x = fgetl(fid);
Data = [Data ' ' x];
end

Data = str2num(Data); % Convert the data from a character array to a
double array

% Group data
A = Data(1,1:5:end);
B = Data(1,2:5:end);
C = Data(1,3:5:end);
D = Data(1,4:5:end);
E = Data(1,5:5:end);
Leonidas Kakalis
2005-10-19 21:41:40 UTC
Permalink
Post by Jeremy Smith
The function takes in the file name as a string and outputs the five
variables. Change values as needed.
[A B C D E] = CLeanAdam('AdamsCar_1.txt')
1. There are 10 lines before the data beings.
2. From where the data begins to the end of the file there is
only data and no further text.
function [A B C D E] = CleanAdam(Filename)
fid = fopen(Filename); % Open the file
HL = 10; % Header Lines before the data begins
% Skip the lines before the data begins
for i=1:1:HL
x = fgetl(fid);
end
% Store data in a 1xn char array
Data = [];
while feof(fid) == 0
x = fgetl(fid);
Data = [Data ' ' x];
end
Data = str2num(Data); % Convert the data from a character array to a
double array
% Group data
A = Data(1,1:5:end);
B = Data(1,2:5:end);
C = Data(1,3:5:end);
D = Data(1,4:5:end);
E = Data(1,5:5:end);
This was a good start for me but i have still the same problems
because most of the times under the end of the first five columns
there are some characters similar to the
characters at the top and then also are starting five columns of
numbers:

The exported file looks like this:

A1.Braking_1
B1.Braking_2
C1.Braking_3
D1.Braking_4
E1.Braking_5

A1 B1 C1 D1 E1
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
.......
.......

A.Braking_1
B.Braking_2
C.Braking_3
D.Braking_4
E.Braking_5

A B C D E
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
.......
.......

so i will have to construct a program that "sees" that after the
numbers there are also some other characters and then numbers. This
is an exemple for 10 variables. If i export 13 variables then the
other 3 variables will be placed under the the last column (10th)
again with the same characters and so on

How it is possibile to skip these characters which are after the
numbers??

Thank you

Loading...