From: matlab_learner on
i would need to call each point in an index notation, so like if i do
L = linspace(-1,1,21) ;

how can I do a loop over each point at L? or specify a condition?

it does look easy but that is the trick to it?

and i need to pass the values of L (at each point) to another variable
(say w)
so if i do w(i) = L(i)

matlab says index has to be integer.

please help me. thank u.
From: matlab_learner on

so when i try to call the ith entry in L matlab would complain,
saying:

??? Subscript indices must either be real positive integers or
logicals.

On Feb 20, 9:24 pm, matlab_learner <cib...(a)gmail.com> wrote:
> i would need to call each point in an index notation, so like if i do
> L = linspace(-1,1,21) ;
>
> how can I do a loop over each point at L? or specify a condition?
>
> it does look easy but that is the trick to it?
>
> and i need to pass the values of L (at each point) to another variable
> (say w)
> so if i do w(i) = L(i)
>
> matlab says index has to be integer.
>
> please help me. thank u.
From: matlab_learner on

so when i try to call the ith entry in L matlab would complain,
saying:

??? Subscript indices must either be real positive integers or
logicals.

On Feb 20, 9:24 pm, matlab_learner <cib...(a)gmail.com> wrote:
> i would need to call each point in an index notation, so like if i do
> L = linspace(-1,1,21) ;
>
> how can I do a loop over each point at L? or specify a condition?
>
> it does look easy but that is the trick to it?
>
> and i need to pass the values of L (at each point) to another variable
> (say w)
> so if i do w(i) = L(i)
>
> matlab says index has to be integer.
>
> please help me. thank u.
From: ImageAnalyst on
Are you trying to do something like this:

L = linspace(-1,1,21) ;
% Loop over all values of L.
% w will take on each and every value in L.
for w = L
disp(w); % Display values that w takes on.
% Do any other stuff you want
end

From: matlab_learner on
Well, I want to be able to call each position in L.

I could ideally do a loop over L (if i have no alternatives) or pass
it to another variable say x.

I am moving along a grid, from -1 through 1, in increments of 0.1 and
will have 21 points, so i will have my solution at 21 points, and then
these solution i would call into another vector or array and iterate
on there.