MATLAB Answers

0

How can I parse A2L file Function Section ?

Asked by ilker ozturk on 22 Sep 2019
Latest activity Answered by ilker ozturk on 27 Sep 2019
Dear Users,
I would like to parse a2l file function interaction. But I could not be succussful.
I have no experience on string processing side of Matlab. Could you help me how can I get function infromations from a2l file?
Example A2L Function Section:
/begin FUNCTION
Vehicle
"0.0.1 Function Name"
/begin DEF_CHARACTERISTIC
Label_1 Label_2 Label_3 Label_4
/end DEF_CHARACTERISTIC
/begin IN_MEASUREMENT
Label_5
/end IN_MEASUREMENT
/begin OUT_MEASUREMENT
Label_7 Label_8 Label_9
/end OUT_MEASUREMENT
/begin LOC_MEASUREMENT
Mp_1 Mp_2 Mp_3 Mp_4 Mp_5
/end LOC_MEASUREMENT
FUNCTION_VERSION "0.0.1"
/end FUNCTION
My Code to READ A2L FUNCTION NAME AND FUNCTION DESCRIPTION
index_number=zeros(k,1);
index_number_a=zeros(k,1);
mm=0;
nn=0;
for i=1:1:k
if (a(i)=="/begin FUNCTION")
nn=i;
index_number_a(i)=nn;
end
end
for kk=1:1:k
if (a(kk)=="/begin DEF_CHARACTERISTIC")
mm=kk;
index_number(kk)=mm;
end
end
index_number_anew=find(index_number_a);
index_number_new=find(index_number);
num=length(index_number_anew);
for pp=1:1:num
t=index_number_anew(pp);
r=index_number_new(pp);
temp=r-t;
for counter=(t+1):1:(r-1)
temp1=strfind(a(counter),'"');
temp2=strcmp(a(counter),"");
if (~isempty(a(counter)) && isempty(temp1)&&(temp2==0))
FunctionNaming(counter)=a(counter);
end
if (~isempty(a(counter)) && ~isempty(temp1)&&(temp2==0))
FunctionDescription1(counter)=a(counter);
end
end
end
Could you offer a suggestion to read a2l file on matlab I will be appreciate to you.

  0 Comments

Sign in to comment.

2 Answers

Answer by Shivam Sardana on 25 Sep 2019

You can use xcpA2L function to read A2L file. You can refer to the link for the documentation of A2L File Management: https://www.mathworks.com/help/vnt/a2l-file-management.html

  0 Comments

Sign in to comment.


Answer by ilker ozturk on 27 Sep 2019

Hi Shivam,
Actually I have checked xcpA2L function on Matlab, Unfortunately, this function does not provide the function relationships. I have to read which function have which charactesristics. If you know how can I get this info from xcpA2L function, please write me becauce I could not get any clue according to my problem.
Have a good weekend.
Ilker

  0 Comments

Sign in to comment.