I was trying to resolve this problem searching in the forum posts, but i didn’t find anything.
Basically i want to write this sentence in the if object
if (in1+in2) < = in3 then out (in1+in3) else out in2
I’m trying with other alternatives, but its much more complicated in the patch I’m doing.
If anyone can help i would really appreciate it.
I don’t think it is possible to do that in a single if object cause of the ($i1+$i3). You’ll probably have to do somthing like that :
----------begin_max5_patcher---------- 518.3oc0V1saBBCFF9X3pnowC1hNCsP8mkcxtNVVV.oncAJFol4lw68UJzM0 HZEUTOAnesz91mu29yRaKXP5BZFD7L3Mfk0RaKKUn7.VkksfI9KFE6moZFjS +JM3SXmhpDzEBUXAHBDoiFkxEYren40fb55TFdpuXzDFe7GyniDEi4PhrV.h nd4h6RjEFz0A7d4uvBU8tbDexant64ySX7XpPIHzZiI2OQMlvWmw7iWq4oyE 51iKiVDR78TZgRfQwo9BXG8Gf2ya2Ja67GcNM3z93AiqWd0.riIjYvNIC9HI CpJxv30EGySBnypqq.2Sg.h5Yky89WVWQ9bW5IB74iuFL.4ZBCH25Lnp8LBp ydFndEnwyjkFtWVznXxItmQMMHZLfIF3P7ticH0ykfKIRwKxv85RvmE73YlK oyU01n4hQ1Fz8osgEAdnEC0tEC+3KsXt.wDJGzh4AnwYT4G3cxMTWxPBZP+C dvDt77o9EGQua3g28ZNuy0oxaRLkBfwL912lSMKxiuIFyRmOajtqzWuBf9ah DRyDLtufkxWuQxaZ.9e1NgEFRU0qMbIrvooxzZoHpHodTZx4.ZJmyMolHFno sD9EWSCLkStMmljqw.3aL+DdCDrGMgZVMgLI2gaNMgLwiia9b2s1dAtll6PM qltw3zVCWE9o9MatyHM4dBZRVXk8urE76WG -----------end_max5_patcher-----------
if you really want to do that in a single object, you could use expr :
----------begin_max5_patcher---------- 415.3oc4UFsSCBCEF9Z3onoYWr4lKT55Fynl3ygwXJP2VMPKA5hSW16tPKDY F2RmFIS8FfdNGNm+90+.accfgxMrBH3Jv8.GmstNN5PUAbpW6.SoahRnE5xf h0ogrb3HSpERgpf+JqJExarWc3LpJZEWr7wbVjxz8fpr.zb8MhYQvXOvC0uB OV2dY3SW5Gzz9xgwEILkdznVyTPS0yDdWNmlzpb4ZUS890QMgTujwLJAxEJ3 H.LjJVBAOTUzNW2pKi5DFDPr.AyN2Q.64Rc1LUEaidKBUfPvhSGLnZ2gtJ.1 eL4HnA+yhFMSJYyhDIU0s9CzIXPl7uxf3OmXLHDKLHj+rFjZLX0GQm96zfv1 jkC52uGGMrG2e.35a.833AWTGAOXXqj2ZxU97W9GRFJ5OY5Qgo2mBS7IBSzg f49DTq.XBW7w+Lq2EUw2GqEx04QMspQtf22HwrBEWPUboncQA6UzJdbLSmug Yo73LY4wbsHNvgr0ZZlMZxqa0D4LUSHazje2oI7YHmv1xIT2ooo1vIR2xoI1 nI72PSkK149F78Bz6A -----------end_max5_patcher-----------
However you can see that the same test is done twice, so that this is not so efficient.
The [if] object cannot do mathematical operations, however if would be possible with [expr] as Charles has shown in his post above. The method I would use is in the patch below and takes advantage of the fact that lists sent to most objects, in this case [+], act as though each element was sent to a successive inlet.
----------begin_max5_patcher---------- 414.3oc0UFsSCBCEF9Z3onoYWnY3BsUFAidgOGlESGT1pBsjQWb5xd2ss.aN iYioLhKgbf92S64uesgt10ANUthUBA2AdB33r10wwJYDbpa6.yoqhynk1zfo YRwxbnWUWETU7btX1yKXwppoAMd7HeOPHxDC7MQrNBlTOD8n4hLlxNcnZwTo PIn4LaIdbAmlA2ktbopIebsZkj58BVUQM1hpfd.3TpXFbawLyaI+CaVHr1KU x7DagjSe4FDAZz135ZBdcFEP2dQQAzYgBiwWRPH5Lx.TPzkADB+MPPvdSO1F KpXqrqc3Pf+niSFRn4EAOJ3PjAehjAcXxbBDInCIRA8UMSpdNJYhHV9fIG9L CoqHyo.EbGBEdJ3pAongCRwWe+CCRI.0bl.nk.lFrrRl9CLv+3mkPAVVgQ+C Q1d+h0NNXFW78aesqMi99brTtbQbSUqu2xCra4kvJUbAUwkhujDVmCdaNy4I ILa2MtKmmTH4BUsG.S9wM0VaITKsDp2rTTKcjeu4nfV3nvd0QsYWKnWcDtEN B8GbjtwF2Ownka3A -----------end_max5_patcher-----------
hi i am just a beginner with max and even not a very good programmer with max. I wish to use if/else for RFID tags.
But I believe that there might be a problem with the my if then else statement. Can you help me out
In general, you’ll get much more help if you post an example of what it is you are trying to accomplish–like the original poster above. Can you describe what you are trying to do?
Thanks for the answers, but I’m having problems opening the patches, maybe because I’m running max 4.5? I’ve done everything the "post patches to the forum post" says.
Yeah, the gibberish-looking text above is in the new Max version 5 compressed text format that makes posting patches much smaller and easier. Unfortunately, that only works in Max 5.
The patch I posted above looked like this:
[if ($f1+$f2)< =$f3 then $f1 $f3 else $f2 0]
With three [flonum] objects going into each inlet of a [pak 0. 0. 0.] before the [if] so that the output is triggered no matter which number box you change. If you have trouble recreating just say and I’ll post a screenshot.
It’s working great!
Thanks a lot, if you are around Buenos Aires i can send you a gift
Thanks to all that replied to!
and now, back to work!
Unfortunately not, but never mind, I’m glad it helped. You should definitely have a look at max 5, you can download a 30 day demo for free, it really is a big step up from working with 4.x!
I am using RFID tags which give output in form of 013e218c..
something of this sort. I am trying to compare the values using if
like $s==……… then send 0 out2 else 1. something like this but it is giving syntax error. is there a method to type cast in max
Try [zl compare] which can match strings and lists.
thanks. I will try it.But can you give me the syntax.
Have a look at the [zl compare] helpfile. It has two inlets and you send one list to each, if they are the same it outputs a 1 else a 0. You could then use [sel] or [gate] to trigger or route information depending on what you’re trying to do.