comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: "Expression Must be a Scalar in this context:" error in nlinlsq function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: "Expression Must be a Scalar in this context:" error in nlinlsq function [message #81221] Tue, 28 August 2012 23:23 Go to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Tuesday, 28 August 2012 18:27:51 UTC+2, elambrid wrote:
>> I would say that the variable aoffxc is a five-element byte array,
>
>>
>
>> when it should be a one-element scalar to use it in a boolean
>
>>
>
>> expression like this. :-)
>
>
>
>> David
>
>
>
> Yes I agree, so I guess what I'm confused about is nlinlsq works like a for loop where the iterations are determined by the amounts of "functions", better word would be the size of you data set. So I have all these variables that look like this e.g a=[b(0)...b(n)] How would I check if one of those values are zero, and perform a statement on them? And thank you for your speedy reply!


B = lonarr(42)
w = dblarr(42)
; ...
zero_ind = where(B eq 0, count)
if count gt 0 then w[zero_ind] = 0

Or simply this if you are going to do something if at least one element in B is zero:

if total(B eq 0) gt 0 then dostuff, B

--
Yngvar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Format code to trim leading zeroes?
Next Topic: Re: Inheriting Properties (or something similar) in IDLDOC

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:45:55 PDT 2025

Total time taken to generate the page: 0.00260 seconds