Merge struct with matrix
2 次查看(过去 30 天)
显示 更早的评论
Hello,
i have a stuct which holds 12 signals. The signals are represented by frequency, power and a vector for each of the signals as seen in the following picture:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/691368/image.jpeg)
I have another matrix of the signals which passed through some model as seen in the follwoing picture:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/691373/image.jpeg)
I would like to merge the struct with the matrix, so that the struct will hold another column/new field where each struct row corresponts to each matrix row. How can I do this w/o for loop?
Thanks!
0 个评论
采纳的回答
更多回答(1 个)
Dhruv G
2021-7-21
say the structure is named s,
s.outputSignal = modelOutputSignal;
adds the matrix as an element to the structure. You can then reference a matrix element as s.outputSignal(rowNumber, columnNumber)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!