我的目標是提示用戶輸入一個值,然後在我的矩陣中輸出與他們輸入的值相對應的行。命令窗口識別我的矩陣,但不輸出特定的行,即使輸入正確的值。Matlab:我想根據用戶輸入顯示特定的矩陣行
這是我到目前爲止。
prompt='Please enter an alloy code: '; %enter either A2042,A6061 or A7005
x=input(prompt);
A2042=a(1, :); A6061=a(2, :); A7005=a(3, :);
%alloy compositions a=[4.4 1.5 0.6 0 0; 0 1 0 0.6 0; 0 1.4 0 0 4.5; 1.6 2.5 0 0 5.6; 0 0.3 0 7 0];
所以當我輸入A2042時,我希望它顯示第1行。出於某種原因,它不合作。感謝您的幫助!
這不回答這個問題。 – excaza
@excaza借調。 –