Thread Subject: simple but urgent

Subject: simple but urgent

From: laux5101@gmx.net (Lex)

Date: 6 Oct, 2004 12:50:38

Message: 1 of 5

Hello,

x=zeros(1000,1);

for i=1:length(Summe)
% for j=1:5
        if Summe(i,1)>=25, x=Summe(i,:)
        
% & (B(j,1) >= 0) >= 3 ;
end
end

Matlab gives me for x just one value (1x1), but there a many values in
'Summe' which are >=0 ???

And how can I predefine x without knowing the exact dimension of x
(lines) in advance?
 

Subject: simple but urgent

From: Waldemar Krzok

Date: 6 Oct, 2004 15:52:14

Message: 2 of 5



Lex wrote:
> Hello,
>
x=[];

for i=1:length(Summe)
      if Summe(i,1)>=25
x=[x; Summe(i,:)];
      end %if
end %for

try above. x will have size (number_gt_25,dim2_of_Summe)

Waldemar

Subject: simple but urgent

From: Brett Shoelson

Date: 6 Oct, 2004 10:03:51

Message: 3 of 5


"Lex" <laux5101@gmx.net> wrote in message news:fz21vkbs48zl@legacy...
> Hello,
>
> x=zeros(1000,1);
>
> for i=1:length(Summe)
> % for j=1:5
> if Summe(i,1)>=25, x=Summe(i,:)
>
> % & (B(j,1) >= 0) >= 3 ;
> end
> end
>
> Matlab gives me for x just one value (1x1), but there a many values in
> 'Summe' which are >=0 ???
>
> And how can I predefine x without knowing the exact dimension of x
> (lines) in advance?
>
>

Hi Lex,
You're clearly new to ML, and probably to programming. I strongly urge you
to read the getting started docs for this program. Besides Waldemar's
solution to your problem, ML has many ways of making dealing with these
kinds of problems a breeze. For instance:

x = Summe(Summe>=25);

Cheers,
Brett

Subject: simple but urgent

From: Waldemar Krzok

Date: 6 Oct, 2004 17:26:14

Message: 4 of 5


>>x=zeros(1000,1);
>>
>>for i=1:length(Summe)
>>% for j=1:5
>> if Summe(i,1)>=25, x=Summe(i,:)
>>
>>% & (B(j,1) >= 0) >= 3 ;
>>end
>>end
>>
>>Matlab gives me for x just one value (1x1), but there a many values in
>>'Summe' which are >=0 ???
>>
>>And how can I predefine x without knowing the exact dimension of x
>>(lines) in advance?
>>
>>
>
>
> Hi Lex,
> You're clearly new to ML, and probably to programming. I strongly urge you
> to read the getting started docs for this program. Besides Waldemar's
> solution to your problem, ML has many ways of making dealing with these
> kinds of problems a breeze. For instance:
>
> x = Summe(Summe>=25);


he needs to compare Summe(:,1), but there are still many ways to do it.

Waldemar

Subject: simple but urgent

From: Brett Shoelson

Date: 6 Oct, 2004 11:36:32

Message: 5 of 5


"Waldemar Krzok" <waldemar.krzok@ukbf.fu-berlin.de> wrote in message
news:41640E96.9070106@ukbf.fu-berlin.de...
>
>>>x=zeros(1000,1);
>>>
>>>for i=1:length(Summe)
>>>% for j=1:5
>>> if Summe(i,1)>=25, x=Summe(i,:)
>>>
>>>% & (B(j,1) >= 0) >= 3 ;
>>>end
>>>end
>>>
>>>Matlab gives me for x just one value (1x1), but there a many values in
>>>'Summe' which are >=0 ???
>>>
>>>And how can I predefine x without knowing the exact dimension of x
>>>(lines) in advance?
>>>
>>>
>>
>>
>> Hi Lex,
>> You're clearly new to ML, and probably to programming. I strongly urge
>> you to read the getting started docs for this program. Besides Waldemar's
>> solution to your problem, ML has many ways of making dealing with these
>> kinds of problems a breeze. For instance:
>>
>> x = Summe(Summe>=25);
>
>
> he needs to compare Summe(:,1), but there are still many ways to do it.
>
> Waldemar
>

I guess I just don't understand his question. Or what Summe is, or what he's
trying to compare.
Brett

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com