Questions tagged [scalar]

In computing and programming, a scalar variable or value refers to a single value, as opposed to data structures such as arrays or lists.

In computing and programming, a scalar variable refers to a single value, as opposed to data structures such as or s. A scalar can be of any type, including a complex type such as an object or string. Being scalar only means that it is manipulated as a single value.

As an example, the string type in C++ is considered to be a scalar as it is a primitive type containing a single value, although in the C language there is no such primitive type. Thus, the char array implementation of strings typically used would not be considered as a scalar.

See also:

532 questions
0
votes
2 answers

C++ - Error: expected type-specifier while creating C wrapper for OpenCV's cv::Scalar::all

Here is the code I'm compiling...I'm creating a C wrapper for cv::Scalar::all so I can wrap in another language... cpp Scalar* cv_create_ScalarAll(double val) { return new Scalar::all(val); } hpp Scalar* cv_create_ScalarAll(double…
user2904561
0
votes
1 answer

MATLAB: Multiplying a matrix by an unknown scalar (variable.)

I am trying to multiply a 3x2 matrix with an unknown scalar ( a number in terms of an unknown variable (t). For instance 10t [<3x2 matrix>]. The variable t has no value and should always appear as a "t" instead of any numeric value. How do I get…
DesertEagle_PWN
  • 81
  • 1
  • 2
  • 8
0
votes
0 answers

Is it possible to convert a stringified reference from a SCALAR back to a REF?

I would like to write a subroutine (say s2r) which can convert SCALAR input, which is a valid stringified reference, to REF type. As a bonus, I'd like the subroutine to convert the input to the original blessed object (or tied reference), if the…
Moh
  • 304
  • 2
  • 8
0
votes
1 answer

C++ Handle overflow/underflow when extracting string to scalars

when extracting data from string to scalars (char, short, int...), how could I easily know if the value I want to get exceeds the type limit? unsigned char function(void) { std::string str = "259"; std::ostringstream…
kirly
  • 101
  • 1
  • 2
  • 5
0
votes
1 answer

Creating .vtk Vector Data from .vtk scalar data

I'm using a fluid simulation software which can create .vtk files of scalars x-velocity, y-velocity, and z-velocity. I'm trying to view streamlines using ParaView, however that requires vectorized data. Is there an easy way to combine the scalar…
Ananth Saran
  • 207
  • 2
  • 17
0
votes
3 answers

scalar value as an array? PHP array

I'm getting this error: '( ! ) Warning: Cannot use a scalar value as an array in C:\xampp\htdocs\or2LAST\admin\adminData.php on line 5` the code for this error (line 5): $admin['push']=array( 1=>"yes", 2=>"no" ); i tried to use…
user3282988
  • 129
  • 1
  • 12
0
votes
1 answer

MATLAB - Error with switch

when i run the following code i get an error message "SWITCH expression must be a scalar or string constant." note that the variable FUD is an cell array of strings and unique(FUD(i,1)) returns a char. also note that this is a runtime error, so the…
0
votes
1 answer

Python scalars error Fix

I'm trying to make an exponential fit to find the Lyapunov Exponent of this data, however, I keep getting this error: m=math.log10(abs(x)) TypeError: only length-1 arrays can be converted to Python scalars and here's the…
user3291404
  • 781
  • 1
  • 5
  • 5
0
votes
2 answers

Trying to find substring in string on sql server

I have read in many articles and including here on stackoverflow that to find a substring the following should be used: IF CHARINDEX('mywoRD', @words) > 0 BEGIN -- DO SOMETHING END I am trying the following but it's not working it always…
jedgard
  • 868
  • 3
  • 23
  • 41
0
votes
1 answer

Java classpath search issue: direct setting vs using environment variables

I have a Scala library that is called from Java. This is scala code. package org.fun object ScalaPower{ def showMyPower(time:Int) = { (0 to time-1).mkString(", ") } } This is Java code. import org.fun.*; public class Test { public…
prosseek
  • 182,215
  • 215
  • 566
  • 871
0
votes
3 answers

Perl signatures: Can Lists be substituted by Scalars?

Take a look at one of the print subroutines of perl: print FILEHANDLE LIST (http://perldoc.perl.org/functions/print.html) I tried it out and it seems that you can also pass a scalar instead of a list. Is that a general rule in perl that wherever a…
ben
  • 5,671
  • 4
  • 27
  • 55
0
votes
1 answer

Perl Sort HoAoH/Scalar

Im trying to sort a HoAoH/Scalar, ignoring scalar entries at the beginning and just sorting the sub HASHes based on key. From $out = { 'bgp 65000' => [ ' undo synchronization', ' graceful-restart', ' peer 192.1683.0.1 as-number…
0
votes
0 answers

Can Derby handle scalar subqueries in SELECT clause?

I'm having trouble getting my query working. Could someone cast an experienced eye on it please? The table structure is simple (2 one-to-many relationships). The query is trying to work out for each sign, how many contributions there are at each…
0
votes
2 answers

Only one expression can be specified when attempting to use select lists in scalar function

The following procedure sets a boolean value based on the rowcounts of each of the following queries and it is then supposed to return the true(1) or false(0) value back to Access; I am currently getting the error of "Only one expression can be…
codingManiac
  • 1,654
  • 4
  • 29
  • 42
0
votes
1 answer

VB.net Getting Scalar to save a value to a variable

I've been looking through the forums with no luck. I am trying to retrieve a value from a database and store it to a variable. The closest I got was following This. Here is my Code: Dim dblAircraftHourlyRate As Double Dim intAircraftID As…
VB noob
  • 3
  • 3