Attempt to write complex data to real data set

Hi,

I run into this error when the code is trying to write the output:

wr = writer(fhirf,irfsim);

And fhirf is a data file created as:

oirf = opath $+ "\\" $+ lmodel $+ lprior $+ dataselstr $+ subTstr $+ "ir";
create fhirf = ^oirf with IRF, 12*nirf, 8;

I guess irfsim contains complex data. Is there a way to change the type of data set from real to complex? Thank you very much!

5 Answers



0



The GAUSS function real will return only the real portion of a matrix, throwing away the complex portion. You can test to see if a matrix has a significant complex portion (i.e. much different from all zeros) with hasimag. However, you probably want to check and find out why that variable is complex. Often this happens when a negative value is passed to the natural log function (ln). This is usually a mistake.

aptech

1,773


0



Thank you for the help. I use y = hasimag(irfsim) to check and y is 1. What should I do next?



0



When I check back, I find the following lines:

nuse=5;

indseq = indseq % nuse;

indseq = indseq .NE 0;

parasim = delif(parasim,indseq);

Could you tell me what is the meaning of them? Thanks a lot!



0



The percent symbol % is the integer modulo operator. For example:

mod = 14 % 3;

will set mod equal to 2. .NE is element-by-element 'not equal'. For example:

//Create 5x1 vector
a = { 5, 1, 5, 1, 3 };

//Create 5x1 logical vector (0's and 1's)
diff = a .NE 5;

will set diff equal to:

0
1
0
1
1

The delif function will delete specified rows of a matrix and assign it to the output. (NOTE: The input matrix itself will not be changed). For example:

//Create 4x2 matrix
x = { 1 2,
      3 4,
      5 6,
      7 8 };

//Create logical vector
mask = { 1, 0, 0, 1 };

//Create new matrix with rows removed
//based upon second input 'mask'
new_x = delif(x, mask);

Will assign new_x to be equal to:

3 4
7 8

Also, if there is a GAUSS function in your code, you can click on it in the editor and click the F1 key to get help on that function.

aptech

1,773


0



Thank you very much!

Your Answer

5 Answers

0

The GAUSS function real will return only the real portion of a matrix, throwing away the complex portion. You can test to see if a matrix has a significant complex portion (i.e. much different from all zeros) with hasimag. However, you probably want to check and find out why that variable is complex. Often this happens when a negative value is passed to the natural log function (ln). This is usually a mistake.

0

Thank you for the help. I use y = hasimag(irfsim) to check and y is 1. What should I do next?

0

When I check back, I find the following lines:

nuse=5;

indseq = indseq % nuse;

indseq = indseq .NE 0;

parasim = delif(parasim,indseq);

Could you tell me what is the meaning of them? Thanks a lot!

0

The percent symbol % is the integer modulo operator. For example:

mod = 14 % 3;

will set mod equal to 2. .NE is element-by-element 'not equal'. For example:

//Create 5x1 vector
a = { 5, 1, 5, 1, 3 };

//Create 5x1 logical vector (0's and 1's)
diff = a .NE 5;

will set diff equal to:

0
1
0
1
1

The delif function will delete specified rows of a matrix and assign it to the output. (NOTE: The input matrix itself will not be changed). For example:

//Create 4x2 matrix
x = { 1 2,
      3 4,
      5 6,
      7 8 };

//Create logical vector
mask = { 1, 0, 0, 1 };

//Create new matrix with rows removed
//based upon second input 'mask'
new_x = delif(x, mask);

Will assign new_x to be equal to:

3 4
7 8

Also, if there is a GAUSS function in your code, you can click on it in the editor and click the F1 key to get help on that function.

0

Thank you very much!


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy