Asked by Ano
on 7 Nov 2016

Hello, I would like to export the impedance matrix from FEKO into matlab but Matlab says that the .mat file is corrupted, any help in this issue?! Thank you in advance

Answer by Klearchos Samaras
on 14 Mar 2017

Edited by Klearchos Samaras
on 15 Mar 2017

Accepted Answer

First of all, this *.mat file is not a typical *.mat file. It has a FORTRAN block structure. You can find some useful information here: http://www.feko.info/support/helpcenter/how-to/how-to-read-the-.mat-.lud-.rhs-files-and-.str-files .

I am a FEKO user too. Well, the mat2ascii.exe utility can be used via Command Prompt and the data can be stored in a *.txt file, however the generated file will only contain the rows, columns, real part and imaginary part of the impedance matrix FOR THE FIRST FREQUENCY OF THE SIMULATION. In other words, if you want to simulate at a frequency range (multiple frequencies) the generated *.mat file contains the data of every impedance matrix, however the mat2ascii.exe utility converts only the data of the first impedance matrix of the simulation to *.txt file. Maybe the *.mat file can be easily read in a FORTRAN environment but I don't know that. I have tried to use the f2matlab routine created by Prof. Ben Barrowes, but it failed. I am no expert in programming, though.

*IMPORTANT: There might be a mistake in the *.txt file generated by mat2ascii.exe. It contains some explanatory text in the beginning and then it contains 4 columns with the data of the first frequency impedance matrix. The first column has the numbers of rows, the second has the numbers of columns, the third has the elements of R matrix (real part) and the fourth has the numbers of X matrix (imaginary part). I believe that the third column should be labeled as imaginary and the fourth as real, because the very first element of the R matrix should always be a positive number (it belongs to the main diagonal and R is positive definite), but in my case it is negative.

Sign in to comment.

Answer by Ano
on 2 Nov 2018

Ano
on 30 May 2019 at 11:40

Hello!

Please find below my suggestions

1- you need to add feko to the path see this it may help

2- the structname = 'excitation' only without any extension.

Hope it helped!

Best regards!

Sumithra Panneer Selvam
on 31 May 2019 at 11:07

Dear Mr.Ano,

Thanks for the suggestion. It worked and the feko file are executing. However there is an error (Error using reshape Size arguments must be real integers). as depicted in the figure. It outputs an ascii file that is empty. What can i do about this. kindly help me.

Ano
on 31 May 2019 at 11:44

Hello!

Yes, I do remember Having this issue but I believe I solved just by checking all the concerned files. First, check the value of rowsM and start from there it wasn't that hard to solve as far as I remember.

Please post the solution so others and I included could prevent this issue if it happens.

good luck and best regards!

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 5 Comments

## sumithra Panneer Selvam (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/311026-how-to-export-the-impedance-matrix-from-feko-into-matlab#comment_538142

## Ano (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/311026-how-to-export-the-impedance-matrix-from-feko-into-matlab#comment_538166

## sumithra Panneer Selvam (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/311026-how-to-export-the-impedance-matrix-from-feko-into-matlab#comment_538521

## sumithra Panneer Selvam (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/311026-how-to-export-the-impedance-matrix-from-feko-into-matlab#comment_538891

## Ano (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/311026-how-to-export-the-impedance-matrix-from-feko-into-matlab#comment_539061

Sign in to comment.