The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Update values of matrix
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

epp

Germany
4 Posts

Posted - 06/08/2005 :  11:34:47 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version: 7.5Pro SR5 (v 7.5870)
Operating System: Windows XP Pro

I want to make an animated contour plot. For achieving this
I want to copy every 500 milliseconds a column of a matrix
onto a column of another matrix. The second matrix is plotted.

As a first step I wanted to check if the data is copied
correctly from the first matrix ("RawData") to the second
one ("AnimData"). But "AnimData" is refreshed only at the time,
when the code is finishing. Using REDRAW_REFRESH has no effect,
REDRAW_REALTIME_SCOPE causes Origin to crash (???).

Funnily enough displaying a MessageBox (commented out in
the source) does refresh the matrix "AnimData".

Does anybody have an idea?

void test()
{
int iMaxRow, iMaxCol;
int iActRow, iActCol;

Matrix mRawData("RawData");
Matrix mAnimData("AnimData");

MatrixObject moRawData("RawData", 0);
MatrixObject moAnimData("AnimData", 0);

if(!mRawData || !mAnimData || !moRawData || !moAnimData)
{
printf("Error! \n");
}

iMaxRow = moRawData.GetNumRows();
iMaxCol = moRawData.GetNumCols();

for (iActRow=0; iActRow<iMaxRow; iActRow++)
{
Sleep(500);

for (iActCol=0; iActCol<iMaxCol; iActCol++) mAnimData[1][iActCol] = mRawData[iActRow][iActCol];

printf ("still there!\n");

mAnimData.Update(FALSE, REDRAW_REFRESH);
// MessageBox(GetWindow(),"");
}
}

Mike Buess

USA
3037 Posts

Posted - 06/08/2005 :  2:23:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I'm not sure that this will fix your problem but I suggest you use LT_execute("sec -p 0.5") instead of Sleep(500). Sleep() stops the entire program and might be preventing the update.

Mike Buess
Origin WebRing Member
Go to Top of Page

epp

Germany
4 Posts

Posted - 06/09/2005 :  02:18:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

thanks for the fast reply.

Using LT_execute("sec -p 0.5") does solve the problem.

Even if I don't understand as the following code for
waiting one second does not stop the whole program
but anyway has not the wished effect:

time(&StartWait);
time(&StopWait);
DiffTime = difftime(StopWait, StartWait);

while(DiffTime<1.0)
{
time(&StopWait);
DiffTime = difftime(StopWait, StartWait);
}
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000