필터 지우기
필터 지우기

Help with an error

조회 수: 1 (최근 30일)
Ali
Ali 2012년 3월 1일
Hello,
I want to ask you how can I solve such an error.
The thing is I want a 2-D array that grows.
x has a length n and is a column vector
L is an nxn vector
this is the prototype of the code.
I cant figure out a way to solve such a question
function [Nt,xe,ye]= PopulationProgress(x,L)
%x=[200000,300000,500,1500]'
i=0;
n=length(x);
Nt=Zeros(n,3);
Nt(:,1)=x;
Nt(:,2)=L*Nt(:,1);
while Nt(:,i)= Nt(:,i+1)
i=i+1;
Nt(:,i)=L*Nt(:,i-1);
Nt(:,i+1)=L*Nt(:,i);
end;
ye=i;
xe=Nt(:,i);
Thank you for any suggestions
Best

채택된 답변

Srinivas
Srinivas 2012년 3월 1일
MATLAB is case sensitive, replace your
Nt = zeros(n,3)
i = 1,
MATLAB does not allow indices to be '0';

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 3월 1일
In your "while" statement, you need to use "==" rather than "="
  댓글 수: 1
Ali
Ali 2012년 3월 1일
Yup, I figured it out. Yet still I am getting an error.
I don't know why.
Nt=Zeros(n,3);
Nt(:,1)=x; have the same size
I am not sure about the syntax of the coding though.
I want the column to be equal to x.
Is this how am I supposed to do it?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by