How to avoid creating 1x1 struct?
Show older comments
I have created within for loop a 1x8 struct origStruct which is visual and very easy to read.

now I also have to do separately another 1x35 struct with interpolated data. Hower, all I can create is this annying 1x1 stuct with 2 fields. what i'm doing wrong?
code is:
newStruct.b = linspace(origStruct(1).b,origStruct(end).b ,35);
newStuct.e = spline(origTimeSteps,[origStruct.e],35);
and I get this which serves no purpose whatsoever since it doesent look like table:

tried code versions like:
newStruct{:}.b = linspace(origStruct(1).b,origStruct(end).b ,35);
newStruct{1:35}.b = linspace(origStruct(1).b,origStruct(end).b ,35);
newStruct.b = deal(linspace(origStruct(1).b,origStruct(end).b ,35));
but none does give proper outcome
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!