fprintf('% 5d %8.3i %8.3i\n',i,strain,stress)
is there a code that can extract the last column of my fprint? the stresses?
thank you very much in advance

 採用された回答

Star Strider
Star Strider 2020 年 11 月 9 日

0 投票

Since you are printing to the Command Window and not a file, likely not.
However ‘stress’ is obviously in your workspace, so there is no need for you to extract it. Just use the value you have.

4 件のコメント

James Tursa
James Tursa 2020 年 11 月 9 日
編集済み: James Tursa 2020 年 11 月 9 日
Assuming your current loop looks like this
for i=1:n
% some calculations here
stress = (some expression);
end
you would change stress to a vector, e.g.
stress = zeros(1,n);
for i=1:n
% some calculations here
stress(i) = (some expression);
end
Star Strider
Star Strider 2020 年 11 月 10 日
James Tursa — Thank you!
I’d not considered that possibility.
James Tursa
James Tursa 2020 年 11 月 10 日
@Star: I was actually responding to a comment made by OP, which has since been deleted for some reason.
Star Strider
Star Strider 2020 年 11 月 10 日
Interesting. I never saw it, so I didn’t delete it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Stress and Strain についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by