How to save and change the position of some fields in a structure?
Show older comments
I have a matrix of buttons (the user choses the number os lines and columns) presented in figure 1. When the user choses the number of lines and columns, there is a struct called sfiles_info which is created with all the combinations of pairs of buttons like in figure 2. When I press the S parameters button, I chose some files of parameters and acording the names of the files, they go to the correct place in the struct - figures 3 and 4. In this case I have 1,1 with 1,2 and 2,2 with 1,2. So in the structure for the first file I will have S parameters in A1 = 1,1 , A2 = 1,2 and A1 = 1,2 , A2 = 1,1. And the same for the other file. So my problem is if after this, the user changes the length of the array, for example 3 lines and 2 columns (figure 5), I have all the combinations in the structure as in the beginnig. But as the combinations are different, the struct changes the A1 and A2 positions - figure 6. What I can't do is as the A1 and A2 changes, it was nice if the other fields changes too for the correct place. But I can't. For exmaple, in figure 6, the parameters should be in A1 = 1,1 and A2 = 2,1 and not A1 = 1,1 and A2 = 3,1.
I am sorry for the long description, I hope you understood my question. In the next figures I have the code I write:
- When the user choses the number of lines and columns - figure 7
- When the user presses S Parameters button - figure 8
- After having the S parameters for the files (two files in this case), next function to write them in the oposite A1 and A2, to stay with 4 lines of S parameters - figure 9
So when the user changes the number of lines/cols, figure 7 is done again. Is there a way to change the place of my parameters according to the place where they are before?
I hope you could help me with an ideia or something. Thank you! :)
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!