필터 지우기
필터 지우기

command window is not working

조회 수: 3 (최근 30일)
Bhavana
Bhavana 2024년 5월 8일
편집: Mann Baidi 2024년 5월 8일
clc;
x=input("Enter the array of x:");
y = input("Enter the array of y:");
n = length(x)
d=zeros(n,n)
for i=1:n
d(i,1)=y(i)
end
for j=2:n
for i=j:n
d(i,j)=d(i,j-1)-d(i-1,j-1);
end
end
fprintf("Difference table\n")
disp(d)
  댓글 수: 1
Ganapathi Subramanian R
Ganapathi Subramanian R 2024년 5월 8일
Could you please elaborate the issue you are facing?

댓글을 달려면 로그인하십시오.

답변 (1개)

Mann Baidi
Mann Baidi 2024년 5월 8일
편집: Mann Baidi 2024년 5월 8일
I am assuming here that you are facing issue while taking an array as an input from the user using the command window.
For taking user input as an array the syntax is in the form of '[x y z a b c]'.
Otherwise, If you know the length of the input array you can use a 'for' loop for taking the user input for each element in the array.

Community Treasure Hunt

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

Start Hunting!

Translated by