Skip navigation
297 Views 8 Replies Latest reply: Jun 19, 2013 12:59 AM by WE RSS
ptc-5152170 Copper 4 posts since
Jun 18, 2013
Currently Being Moderated

Jun 18, 2013 5:11 AM

On Error Programming

Hey

 

 

I'm kinda new to Mathcad, but it works ;D
Now I'm wondering if there is any possibility to use "on error" programming. (see attachement)

 

 

I want to return "1" if the match function found at least one zero element in a collumn of the given and "0" if not.
"0" won't work because of the error message by Matchcad.


The example is in German, so here the commands in English:

vergleich(z,A) = match(z,A)

And my own procedure: istNullVorhanden="isAnyZeroElement"

 

I use Mathcad 15. I also try to find a clue in previous community entries, but I only found the statement that "on error" programming is a way for the match() function.

 

Thank you for every help ♥

Attachments:
  • AlanStevens Platinum 1,214 posts since
    Jun 8, 2010
    Currently Being Moderated
    Jun 18, 2013 6:24 AM (in response to ptc-5152170)
    Re: On Error Programming

    Like so:

     

    match.PNG

    Alan

  • WE Platinum 4,082 posts since
    Nov 3, 2009
    Currently Being Moderated
    Jun 18, 2013 6:36 AM (in response to ptc-5152170)
    Re: On Error Programming

    In the future please attach the Mathcad worksheet, not just a pic.

     

    You are right, you will need the "on error" construct as match will  throw an error in case it does not find a match.

     

    One possible way

    Nullen.png

    Another way would be to do without match and simply compare the product of the vector elements against zero - see attached.

    A more natural way would be to write ones own count() routine.

    Attachments:
    • WE Platinum 4,082 posts since
      Nov 3, 2009
      Currently Being Moderated
      Jun 18, 2013 8:22 AM (in response to ptc-5152170)
      Re: On Error Programming

      Actually I'm not a fan of "programming by clicking" everything together, but there is no other opportunity,isn't it? :/

      You cannot just type in those tokens, only alternative to clicking is the use of the keyboard shortcuts. But be aware that in the localized version they do not all work as stated in the help or tooltip. E.g. "on error" is not Ctrl+' but Ctrl+ä in the German version, or better said with a German keyboord layout.

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 3 points
  • Helpful Answers - 1 points