Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Programming problem

Subject: Programming problem

From: Milos Milenkovic

Date: 4 Mar, 2013 09:26:08

Message: 1 of 4

Dear,
I have problem with replacing goto command in Matlab.
The code is something like this:
1 generator of a random matrix B1=-0.1+(0.1+0.1).*rand(4,4);
2 set of matlab commands ->
Ke=wn1(B0,B1,K0,K1); %wn je kod za racunanje kovarijanse belog suma
[Delta1, Error1]=d1(B1,K1,Ke);
[Delta0, Error0]=d2(B0,B1,K0,Delta1,Ke);
3 if (condition statement) ->
if (Delta0(i,j)<2) && (Delta1(i,j)<2)
[B0,B1]= up(B0,B1, Delta0, Delta1)
4 elseif goto 1 (generator again)
So, how to close this set of steps?
Thanks in advance.
Best,
M

Subject: Programming problem

From: Torsten

Date: 4 Mar, 2013 11:02:08

Message: 2 of 4

"Milos Milenkovic" <m.milenkovic@mathworks.com> wrote in message <kh1pbg$3ph$1@newscl01ah.mathworks.com>...
> Dear,
> I have problem with replacing goto command in Matlab.
> The code is something like this:
> 1 generator of a random matrix B1=-0.1+(0.1+0.1).*rand(4,4);
> 2 set of matlab commands ->
> Ke=wn1(B0,B1,K0,K1); %wn je kod za racunanje kovarijanse belog suma
> [Delta1, Error1]=d1(B1,K1,Ke);
> [Delta0, Error0]=d2(B0,B1,K0,Delta1,Ke);
> 3 if (condition statement) ->
> if (Delta0(i,j)<2) && (Delta1(i,j)<2)
> [B0,B1]= up(B0,B1, Delta0, Delta1)
> 4 elseif goto 1 (generator again)
> So, how to close this set of steps?
> Thanks in advance.
> Best,
> M

http://www.mathworks.com/matlabcentral/fileexchange/26949-matlab-goto-statement

Best wishes
Torsten.

Subject: Programming problem

From: Steven_Lord

Date: 4 Mar, 2013 15:11:19

Message: 3 of 4



"Milos Milenkovic" <m.milenkovic@mathworks.com> wrote in message
news:kh1pbg$3ph$1@newscl01ah.mathworks.com...
> Dear, I have problem with replacing goto command in Matlab.
> The code is something like this:
> 1 generator of a random matrix B1=-0.1+(0.1+0.1).*rand(4,4);
> 2 set of matlab commands ->
> Ke=wn1(B0,B1,K0,K1); %wn je kod za racunanje kovarijanse belog suma
> [Delta1, Error1]=d1(B1,K1,Ke);
> [Delta0, Error0]=d2(B0,B1,K0,Delta1,Ke);
> 3 if (condition statement) ->
> if (Delta0(i,j)<2) && (Delta1(i,j)<2)
> [B0,B1]= up(B0,B1, Delta0, Delta1)
> 4 elseif goto 1 (generator again)
> So, how to close this set of steps?

satisfied = false;
while ~satisfied
  % step 1
  % step 2
  % step 3
  % if delta condition satisfied
    satisfied = true;
  % else
  % end
end

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Programming problem

From: Milos Milenkovic

Date: 4 Mar, 2013 19:49:08

Message: 4 of 4

Dear Steven and Torsten,
this is good, thanks!!
Best

Tags for this Thread

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.

Contact us