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 #81235 is a reply to message #81234] Tue, 28 August 2012 09:23 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
elambrid writes:

> So within the function I am using in nlinlsq, I have a common block that contains some global variables that are found within my main routine and used in my function (for simplicities sake it's called ddr). Since nlinlsq works on a "number of functions" basis you pretty much have to recast everything as 1D. I would like to check within my function if a value of one of my arrays is 0, yet the if statement keeps giving me an error of " Expression must be a scalar in
this context: <BYTE Array(5)>." Below is a sketch of the code. Thanks in advance!
>
> pro auto_target_offset
>
> common offset_vals3,blah1,blah2,blah3,...,blah13,aoffxc,aoffyc
> ...
> solution=nlinlsq("ddr",5,3)
> ...
> end
>
> function ddr,m,r
>
> common offset_vals3 (same as above)
> ...
> if aoffxc eq 0 then w=0
> ...
> end
>
> Thanks again!

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. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[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 19:12:01 PDT 2025

Total time taken to generate the page: 0.00566 seconds