Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi all I am using the readexcel function in mathcad prime 6.0.0.0 and to even read in a number it comes in as not a scaler. is there a set format in excel that i am missing as you can see the number below comes in in brackets [1] as an example. I have tried both .xlsx and .xlsm file types both give me the same.
note: the if function below is just an example to show I cant use the data brought in because of the [1] (brackets).
Thanks
Ben
Solved! Go to Solution.
You should (ALWAYS) attach THE worksheet, or at least A worksheet, that demonstrates the problem.
Anyway, I can see that you DID NOT type the opening square bracket before ORIGIN. It isn't there for nothing.
This is what you should get,
and attached Prime file has the expression as well.
ORIGIN is not a function, but a Mathcad/Prime system variable that defines the origin of indexing in matrices and vectors (arrays). By default it is set to 0 (meaning that the first element of vector V is V0, but it can be set to any value (in real Mathcad ) or to 0 or 1 (in Prime).
Success!
Luc
(Apparently) READEXCEL reads in the data from the excel file as an array (or a 'vector' if you will). If you only read in a single number, it will be a on-element vector in Prime. That's what the square brackets indicate.
If you take the first element of that vector, you have your number.
If you type
[ORIGIN
At the end of calling the READEXCEL function, so immediatley after the closing bracket ) and before the =
that should do it.
Alternatively you can take the element in your little program, by adding the [ORIGIN to the variable A.
Note that if you have a vector, you cannot compare it to a scalar (=single number).
Success!
Luc
Thanks Luc
it hasn't appeared to work, still getting the [1]
Doesn't work outside the bracket either
You should type
[ORIGIN
(Exactly that! A square bracket followed by ORIGIN)
Immediately AFTER the ) of the expression, and BEFORE the =
The result should look like:
Essentially what it does is indexing the vector obtained by the READEXCEL call, and taking/pointing to, the very first element of that vector.
Success!
Luc
Hi Luc
I have tried the various combinations below and it doesn't appear to work, it returns the number as 0 when the actual input is 1.
the ORIGIN before or after returns 0 but the excel cell is 1 as shown below
thanks
ben
Thanks Luc
its giving me an error below;
can you attach a sheet?
thanks
Ben
You should (ALWAYS) attach THE worksheet, or at least A worksheet, that demonstrates the problem.
Anyway, I can see that you DID NOT type the opening square bracket before ORIGIN. It isn't there for nothing.
This is what you should get,
and attached Prime file has the expression as well.
ORIGIN is not a function, but a Mathcad/Prime system variable that defines the origin of indexing in matrices and vectors (arrays). By default it is set to 0 (meaning that the first element of vector V is V0, but it can be set to any value (in real Mathcad ) or to 0 or 1 (in Prime).
Success!
Luc
Thanks Luc
Thats Great!