error procedure

I would like to test the procedure. But he doesn't loading because they error in procedure.
macro test()
variable a,b,c,var1
variable/C cvar1
Make wave1
a=1
b=2
c=3
var1=a*b
cvar1=c*complex(a+1,b-1)
wave1=var1+real(cvar1)
please use the <pre><code class="language-igor">&lt;/xml&gt; and &lt;xml&gt;</code></pre> tags to mark code; it is better to read.
I'd advise to use functions instead of macros.
The 'procedure' should be terminated by an end.
Please turn on the debugger (right click on the code window -> Enable Debugger); it might be helpful
Complex declares a variable (see manual) I guess you are looking for cmplx
Change Make wave1 to Make /O wave1 to overwrite the wave. It will prevent the "wave already exists error".

Keep going,
HJ
First ...

* Please learn how to post Igor Pro code in < igor >< /igor > tags.
* Please provide more details beyond the statement "This is broken, how do I fix it". What is the exact error message?
* Please learn how to use the debugger to track where the error arises. Include that with your posting.
* Please learn how to post the complete function. Yours has no return or end.
* Consider using Functions rather than Macros.

Now ... I see perhaps a few mistakes. The make wave1 command makes a real wave with default dimensions. Is this a problem? Alternatively, the wave=... command has no running index, so the wave will be entirely filled with the same value. Is this a problem?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
I added the required tags to the original post. The lack of an End statement made me think the lack of tags caused something to be missing. But in fact, that's all there is.

To the original poster: since it has no End statement, it seems like you didn't post the entire macro. If that is all your code, then the lack of End is at least the most basic problem. Please tell us what you are trying to accomplish and what the error is.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
HJDrescher wrote:
From another post http://www.igorexchange.com/node/7493#comment-1 we know that 'we' have a new fellow.
@JW: I assume the intention is to learn ;-)

Are you referring to my editing of his post to add the tags? Point taken, but if I'm not mistaken, you folks lose the ability to edit your posts after some time passes. I can do it any time I like :)

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
No. I'm referring to
Please tell us what you are trying to accomplish and what the error is.

I just pointed out that this is most likely not real-world problem to be solved but rather a broken example how to get started.
Sometimes experienced folks tend to find solutions to problems that are just simple questions ;-) (happened to me last week...)

I think it's a good idea that 'we' loose the edit-option after some time; Otherwise, it usually leads to misunderstandings, confusion, misuse, and the end of the universe.

HJ
I would like to see the value of wave1.I add end and edi in my program :
macro test()
variable a,b,c,var1
variable/C cvar1
Make wave1
a=1
b=2
c=3
var1=a*b
cvar1=c*complex(a+1,b-1)
wave1=var1+real(cvar1)
edit wave1
end
There are always error in Procedure test
Have you considered the points below, apart from the end problem?

HJDrescher wrote:
please use the <pre><code class="language-igor">&lt;/xml&gt; and &lt;xml&gt;</code></pre> tags to mark code; it is better to read.
I'd advise to use functions instead of macros.
The 'procedure' should be terminated by an end.
Please turn on the debugger (right click on the code window -> Enable Debugger); it might be helpful
Complex declares a variable (see manual) I guess you are looking for cmplx
Change Make wave1 to Make /O wave1 to overwrite the wave. It will prevent the "wave already exists error".


jjweimer wrote:
First ...
* Please learn how to post Igor Pro code in < igor >< /igor > tags.
* Please provide more details beyond the statement "This is broken, how do I fix it". What is the exact error message?
* Please learn how to use the debugger to track where the error arises. Include that with your posting.
* Please learn how to post the complete function. Yours has no return or end.
* Consider using Functions rather than Macros.

Now ... I see perhaps a few mistakes. The make wave1 command makes a real wave with default dimensions. Is this a problem? Alternatively, the wave=... command has no running index, so the wave will be entirely filled with the same value. Is this a problem?

modou wrote:
I would like to see the value of wave1.I add end and edi in my program :
macro test()
variable a,b,c,var1
variable/C cvar1
Make wave1
a=1
b=2
c=3
var1=a*b
cvar1=c*complex(a+1,b-1)
wave1=var1+real(cvar1)
edit wave1
end

There are always error in Procedure test


This version of your macro works for me and returns the value "8" for each row in the wave. This is the expected result.

The primary change is to substitute "cmplx" for "complex" in line 9; cmplx is the Igor function for returning a complex number. (I think this was suggested by another reply to your post.) Also, I added the flag "/O" to the Make wave1 operation so that there is no error if you run the macro multiple times. This command instructs the interpreter to overwrite wave1 if it already exists; otherwise execution will stop with an error at that operation.

Finally, as suggested before, put <pre><code class="language-igor">&lt;/xml&gt; before the first line of Igor code in your posts to this site and then put &lt;xml&gt;</code></pre> after the last line of code. Then the code will display as shown below. This has the effect of highlighting code, making it easier to read and prevents your code from being cut off because of the way this site interprets "<" and ">" symbols.

macro test()
 variable a,b,c,var1
 variable/C cvar1
 Make/O wave1
 a=1
 b=2
 c=3
 var1=a*b
 cvar1=c*cmplx(a+1,b-1)
 wave1=var1+real(cvar1)
 edit wave1
 end