How can i save input prompt for a while loop

8 ビュー (過去 30 日間)
Kristian Gullner
Kristian Gullner 2016 年 5 月 21 日
回答済み: Walter Roberson 2016 年 5 月 21 日
Hi i am pretty new to matlab and i was wondering how i can save a "user answer" for a while loop. I mean, so that the question doesn't pop up every time in the loop. The answer to the input should be save throughout the loop.
while det(F) > 0;
N = N-1000; % Initial load decreased
[a, b] = berry(N,E,I,L); % retrieve a and b
[K1,K2]=LS; % 6x6 stiffness matrix fixed-fixed
[beam1,col1]=frame; %<--- (now it is in this function the input is asked)
F = beam + col;
det(F);
end
Depending on the input the user gives, the initial 6x6 matrix is scaled down to a 4x4 matrix.
Hope you can help me! =) hehe

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 5 月 21 日
beam_init = false;
while det(F) > 0;
N = N-1000; % Initial load decreased
[a, b] = berry(N,E,I,L); % retrieve a and b
[K1,K2]=LS; % 6x6 stiffness matrix fixed-fixed
if ~beam_init
[beam1,col1]=frame; %<--- (now it is in this function the input is asked)
beam_init = true;
end
F = beam + col;
det(F);
end

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by