Save E Field results of varying dimensions with script



There is probably an easy answer for this that I am missing, so sorry in advance if that is the case.

I have found a few times now when writing a script that sweeps over the size of an element (waveguide cross-section for example) that it is not easy to save the E-field, because I do not know the size of the matrix in advance since with each new cross section the mesh changes.

Also, the size of the E-field matrices for different meshes will be different for each object size I am sweeping over thus it is not easier to store all the results in one matrix. If the field results always have the same size then it is straightforward, but that is not the case here.

Is there some simple programming trick I am missing here?



Well, I was right there was a an easy way to do this. I can create a cell array and add each new 2D matrix with different dimensions to a new element of the cell array.



Dear @john.jost

I am glad to hear that you found a solution to your inquiry.

Thanks for keeping us updated.