Restructure/align struct by interpollation/padding
显示 更早的评论
Having a 3x1 struct s with fields x and y, where (if represented in a form of a table):
x y
[1;2] ['a';'b']
[2;4] ['c';'d']
[1;3;4] ['f';'g';'h']
I need to restructure the struct so that the values in each field of x and y are padded/interpollated by zeros so that they are of a uniform size and linearly spaced, "aligned" so to say, based on the series of [1;2;3;4] and the y field "mirrors" the padding/interpollation of x. The desired result is this:
x y
[1;2;0;0] ['a';'b'; 0 ; 0 ]
[0;2;0;4] [ 0 ;'c'; 0 ;'d']
[1;0;3;4] ['f'; 0 ;'g';'h']
How do I achieve this in Matlab using it optimal methods like vectorization etc., please?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!