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
 LabTalk Forum
 matrix data type
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

chollinger

Germany
2 Posts

Posted - 06/08/2002 :  4:34:22 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Does anyone know how i can set the matrix internal data type to double without prompting?

any help would be nice...

christoph

****Edit****

i tried code like:

.
.
.
win -t matrix MASTER;
Image.FileName$ = %A;
run.section(imgfile,LoadImageIntoMatrix);
win -r %H RealImage$(ii);
matrix -in
matrix -id;
set RealImage$(ii) -it 0;
.
.
.

what i get is that the data type is set to double but the data i just imported is gone...

any ideas?

greetings

christoph

Edited by - chollinger on 06/08/2002 18:06:40

cpyang

USA
1406 Posts

Posted - 06/10/2002 :  6:59:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
When changing internal data type, original data is lost, so one has to backup and restore the data, as shown in the following Origin C program,

 
void setMatDouble()
{
MatrixLayer mat = Project.ActiveLayer();

if(mat == NULL)
{
out_str("no valid matrix a active window");
return;
}
if(mat.GetInternalData() == FSI_DOUBLE)
{
out_str("already double, no need to set again");
return;
}

Matrix<WORD> bb(mat); // assume you know the matrix data type

matrix temp; // both matrix and Matrix default is double

temp = bb; // store the Origin matrix into our temp double matrix

mat.SetInternalData(FSI_DOUBLE); // set matrix layer internal data type

Matrix aa(mat); // attach a double matrix object to the new matrix

aa = temp; // put original data back
}








Go to Top of Page

chollinger

Germany
2 Posts

Posted - 06/11/2002 :  10:15:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the help!

it seems to work also with:

#include origin.h

int setMatDouble()
{
MatrixLayer mat = Project.ActiveLayer();

if(mat == NULL)
{
out_str("no valid matrix a active window");
return 0;
}
if(mat.GetInternalData() == FSI_DOUBLE)
{
out_str("already double, no need to set again");
return 0;
}

mat.SetInternalData(FSI_DOUBLE,1,0); // set matrix layer internal data type

return 0;
}


CU

Christoph
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