How do I make an array of numbers in the titles of a structure?
9 views (last 30 days)
Show older comments
I have the following problem, I have the following set of equations including symbolic terms,
eq = K*U == F;
I solved the set of equations according to,
FU_antwoord = solve(eq,[F(1), U(2), U(3), U(4)]);
This provides me with an 1x1 struct with 4 fields (FU_antwoord), now I want to convert these to numerical values:
u2 = double(FU_antwoord.U2);
u3 = double(FU_antwoord.U3);
u4 = double(FU_antwoord.U4);
This works, but I'll have an arbitrary number elements U's (U5, U6, ...). I tried to work with fprintf, to eventually double these expressions, but this did not work.
for i = 1:N_elements
FPF = fprintf('M_antwoord.U%1.0f\n', i)
end
What is a more constructive way of retrieving the numerical values from a structure with an arbitrary number of elements?
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!