mazdak
Junior Member level 3
Hi,
I want to import the result of the fft in Hspice *.lis file to Matlab, here is a part of the text file that i wanna use (the fft_mag is important for me now):
...
frequency frequency fft_mag fft_mag fft_phase
index (hz) (db) (deg)
205 10.0098x 0. 1.0000 -90.0948
410 20.0195x -74.5959 186.2961u 93.9587
615 30.0293x -74.2619 193.6005u -2.9902
820 40.0391x -73.5943 209.0668u -124.8979
1025 50.0488x -81.0959 88.1462u 117.2375
1230 60.0586x -89.3502 34.0794u 80.9893
1435 70.0684x -85.3732 53.8689u -195.5287m
1640 80.0781x -91.3661 27.0205u -75.9253
1845 90.0879x -100.0618 9.9291u -95.4531
...
I wrote this function to do this :
data = fscanf(fid,'%c');
loc2 = findstr('(deg)',data);
i=68;
for k=1:8
A=data(loc2+i:loc2+i+61);
temp=sscanf(A,'%*s %*s %*s %s %*s');
DATA(k)=temp;
i=i+63;
end
fclose(fid);
-------------------------
I was successful until finding the fft_mag value of each row, but I can't store them in any kind of variable. for this part of code the error is:
Subscripted assignment dimension mismatch.
Error in ==> readtext at 18
DATA(k)=temp;
can anyone help me? with correcting this code or giving me ideas how to it?
thanks in advance
I want to import the result of the fft in Hspice *.lis file to Matlab, here is a part of the text file that i wanna use (the fft_mag is important for me now):
...
frequency frequency fft_mag fft_mag fft_phase
index (hz) (db) (deg)
205 10.0098x 0. 1.0000 -90.0948
410 20.0195x -74.5959 186.2961u 93.9587
615 30.0293x -74.2619 193.6005u -2.9902
820 40.0391x -73.5943 209.0668u -124.8979
1025 50.0488x -81.0959 88.1462u 117.2375
1230 60.0586x -89.3502 34.0794u 80.9893
1435 70.0684x -85.3732 53.8689u -195.5287m
1640 80.0781x -91.3661 27.0205u -75.9253
1845 90.0879x -100.0618 9.9291u -95.4531
...
I wrote this function to do this :
data = fscanf(fid,'%c');
loc2 = findstr('(deg)',data);
i=68;
for k=1:8
A=data(loc2+i:loc2+i+61);
temp=sscanf(A,'%*s %*s %*s %s %*s');
DATA(k)=temp;
i=i+63;
end
fclose(fid);
-------------------------
I was successful until finding the fft_mag value of each row, but I can't store them in any kind of variable. for this part of code the error is:
Subscripted assignment dimension mismatch.
Error in ==> readtext at 18
DATA(k)=temp;
can anyone help me? with correcting this code or giving me ideas how to it?
thanks in advance