I am using a third party software command that returns a cell with X rows and 1 column (e.g. 42x1 cell). The rows contain strings that correspond to chemical phases (e.g. ETA, GAMMA_PRIME, etc.). I have set it up in MATLAB to run this computation N times, and so it will produce such a cell N times. However, on some occasions they will be slightly different in that there may be an extra row (e.g. ETA and ETA#2 might appear), therefore creating a cell with a slightly different number of rows. To illustrate this:
Run N = 1, I get 41 phases:
Run N = 2, I get 42 phases (notice everything is the same except there is a MU_PHASE#2 phase in there, shifting things down):
I am also getting numerical quantities for each of these "Phases" and so this addition/subtraction can really mess up my automated code! My question is therefore:
Is there a way to have it "check" the list on each Nth pass and align it by adding/subtracting rows so that, in the end, they all have the same number of rows? For example: Run 1 above does not have a "MU_PHASE#2" but can we add in a "MU_PHASE#2" row anyway and set it to equal 0?
I know this probably has an easy solution, but I have tried for many hours to figure out an appropriate solution but failed to do so. Any help would be greatly appreciated!
0 Comments
Sign in to comment.