Trying to assign names to output values of 10x10
1 view (last 30 days)
Show older comments
So I am working on a truss problem where I end up with 10x10 matrix. After solving, I get only values in the output. But I’m trying to assign name of the forces (i.e A_x, B_x etc) to the values.
How can I do that?
0 Comments
Answers (2)
Sulaymon Eshkabilov
on 26 Sep 2021
Should I understood your question correctly, you want to assign variable names for your computation output values. If so, that is very straightforward, e.g.:
...
% Output is:
OUT = ....
Ax = OUT(1,1); Bx = OUT(2,1); ...
Sulaymon Eshkabilov
on 26 Sep 2021
It can be done this way, e.g.:
OUT = rand(5,1);
for ii = 1:numel(OUT)
fprintf('Ax(%d) = %f \n', [ii, OUT(ii)])
end
%% OR
OUT = rand(5,1);
fprintf('Ax = %f \n', OUT(1))
fprintf('Bx = %f \n', OUT(2))
fprintf('Cx = %f \n', OUT(3))
...
0 Comments
See Also
Categories
Find more on Structural Analysis 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!