The meaning of code on this program
1 回表示 (過去 30 日間)
古いコメントを表示
Hi.
i met a question on this program, this is professor's code.
While, i confused for the M(r,c) = input(': ');
What is purpose of this code and why it is used on this program ?
% question: let users enter 9 numbers and output a 3*3 matrix,
clear all
clc
rows = 3;
cols = 3;
M = [];
for r = 1:rows
for c = 1:cols
fprintf('Enter the value for row %d column %d',r,c);
M(r,c) = input(': ');
end
end
0 件のコメント
採用された回答
KSSV
2022 年 3 月 31 日
You shoould run the code o understand it your self.
What is purpose of this code and why it is used on this program ?
The purpose of the line is to take the user input, for rth row and cth column. Read about the function input. Try
doc input
help input
There should be a small change in the code. Dont use
M = [] ;
You should initilaize the matrix M.
M = zeros(rows,cols) ;
7 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Audio Processing Algorithm Design についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!