필터 지우기
필터 지우기

Variable might be set by non scalar operator

조회 수: 14 (최근 30일)
Ella
Ella 2023년 3월 9일
편집: Voss 2023년 3월 9일
clc
m=('insert value');
fib=[];
%define first few values
fib(1)=0;
fib(2)=1;
fib(3)=2;
%code for calc nth term in fibonacci series
%include code for calculating golden ratio
for i = 3:m
fib(i)=fib(i-1)+fib(i-2);
ratio=fib(i)/fib(i-1);
fprintf('%d\t%d\t%f\n', i, fib(i), ratio);
end
getting an error when I do i=3:m, says m is not a scalar operator??

답변 (1개)

Voss
Voss 2023년 3월 9일
m=('insert value');
should be
m=input('insert value');

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by