"scan from string" to timestamp doesn't work for 18:00:00 (6PM)
I just found a strange issue in LabVIEW. I hope I'm doing something silly, but I just may have found an unusual bug.
run the snippet below with the following for the input string: 03:00:00,18:00:00,17:00:00
Time converts fine for just about any other time EXCEPT 18:00:00 (6 PM) for which it is returned as 00:00:00 (midnight). If you even add a second to it (18:00:01) you get back the expected result.
Here's hoping I'm not loosing my mind
Matt Holt
Certified LabVIEW Architect
Solved!
Go to Solution.
Attachments:
TimeParseBug.vi 11 KB
As annoying as it may seem, this exact scenario is an abuse of the timestamp. A timestamp is meant to be used for absolute times. And that includes a date. As Ravens Fan already pointed out, the 0 seconds since January 1, 1904 GMT is used in all timestamp display routines to mean the canonical invalid timestamp and hence the timestamp control displays the default string indicating the actual date/time format rather than a specific date/time.
If you need an absolute timestamp, for instance because you do want to have a local time indication, although the date is not relevant, adding an offset of 86400 to all values would fix it once and for all. Now the timezone offset can't cause the timestamp to reach 0 ever, even if you reside west of GMT, and it will be fine (until you start to do timestamp arithmetic that involves subtraction of relative timespans, then you would have to make the offset big enough that this will never get an issue). The current date would serve as a nice offset for that, which would be MattH's last suggestion. Nice to see that the Scan from String routine actually does use the passed in timestamp as default value and only replaces the values it is configured to parse.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions
Similar Messages
-
How can I upload a video from my PC through I tunes to camera roll on my iPhone? Is there an app or format of specific video supported? Sync from photos include video doesn't work for me.
download the new you tube apps in i tunes, in os6 just pick a video in the photos apps and select share, the old you tube app icon will appear
-
Scan from string to timestamp not working
Hi,
I have a problem with the "Scan from string".
The format string "%<%H:%M:%S%ds%bs%y>T"
works for the input string "11:12:1322sJans2010"
but doesn't work for the input string "11:12:1322sFebs2010"
The only difference is the month (Jan or Feb). I got know idea why!
Could anyone help me?
Regards,
Marcelo
Attachments:
dateString.vi 6 KB
date.PNG 5 KBBoth work for me in LabVIEW 2009; perhaps this was a bug in 8.6 that's been fixed?
Also, is it possible your operating system is running a different language, in which Jan is the abbreviated form of January but February is something else? -
Strange "Scan From String" to Timestamp Error
hi,
i am trying to parse my time-string into a Time Stamp with "Scan From String" but i get some strange Error(1).
The Code:
The Error:
can anyone confirm? do i have an error in my parser-string?
is it possibly related to this Bug
461196
Scan From String VI returns Error 1 with "%t" as the format string input
http://www.ni.com/product-documentation/52151/en/
that should be fixed?
my labview version is
LV 2014 Service Pack 1 -- Version 14.0.1 (32bit)
with the RealTime addon (but the code in question was not run on RT)
thanks for your time.
Solved!
Go to Solution.Why do you have the square brackets around the scan from string format string? They are not there when you generate the timestamp string so it will fail when trying to convert it back as they are expected to be there.
Certified LabVIEW Architect, Certified TestStand Developer
NI Days (and A&DF): 2010, 2011, 2013, 2014
NI Week: 2012, 2014
Knowledgeable in all things Giant Tetris and WebSockets -
[kde] "Only show tasks from the current desktop" doesn't work for max
Hi,
I have two monitor setup (laptop + main monitor) and I would love to use "Only show tasks from the current desktop" option in KDE Task Manager but for some strange reason it doesn't work for me. Well, it works but only partially - for restored/unmaximized windows. When I maximize one it appears on the Taskbar on both screens. Is this normal? May it be due to the fact that I've placed Taskbar on top of the screens?Did you miss this bit
"Graphics : 1 GB NVIDIA Quadro 600 (1DP & 1DVI-I) (1DP-DVI & 1DVI-VGA adapter) (ELGA13) 1"
And the final image clearly states the type of Graphics Card he has
Photoshop CS6 GPU FAQ
Tested video cards for Photoshop CS6
Adobe tested the following video cards before the release of Photoshop CS6. This document lists the video card by series. The minimum amount of RAM supported on video cards for Photoshop CS6 is 256 MB. Photoshop 13.1 cannot display 3D features if you have less than 512 MB of VRAM on your video card.
Important: This document is updated as newly released cards are tested. However, Adobe cannot test all cards in a timely manner. If a video card is not listed here, but was released after May 2012, you can assume that the card will work with Photoshop CS6.
Adobe tested laptop and desktop versions of the following cards. Be sure to download the latest driver for your specific model. (Laptop and desktop versions have slightly different names.)
nVidia GeForce 8000, 9000, 100, 200, 300, 400, 500, 600 series
nVidia Quadro 400, 600, 2000, 4000 (Mac & Win), CX, 5000, 6000, K600, K2000, K4000, K5000 (Windows & Mac OS) -
AirDrop from Yosemite to iOS8 doesn't work for me
Hi there,
I think I know the answer to this (but I hope not because it's lame).
I have a 2011 macbook pro that can airdrop to other macs fine but I can't seem to do it to my iPhone 6 (running iOS 8). Is this because my mac is too old? I keep looking into the airdrop thing because it sounds great but I just never seem to have the correct arrangement of devices to make it work
Thanks,
PeteYes, it's too old.
Mac Basics: AirDrop lets you send files from your Mac to nearby Macs and iOS devices - Apple Support
"In order to transfer files between a Mac and and an iPhone, iPad or iPod touch, your iOS device needs iOS 7 or later installed and your Mac needs to be a 2012 or later model." -
Reading 16 & 22 bit signed integers using Scan From String
Last week it was suggested to use Scan from String which is a new tool for me and worked well to be able to read in ans parse strings.
After parsing the string, I'm having trouble converting the numbers into signed integers. The magnitude of some of the the outputs are unreasonably high then flip to near 0 then back up again.
Sample String (With spaces added)
$ 00 FCCE 00F6 3FFA93 0BFE 0C89 0DDB
Message Format:
Bytes 3-6 FCCE Heave acceleration bits 15-0 15-bit data, sign extended to 16 bits LSB : 0.001261g Sign “+” when accelerating upward
Bytes 11-16 3FFA93 FOG Gyro 1 bits 21-0 Bits 22-23 are always zero 22-bit signed data LSB = 97.275 µ˚/s Sign corresponds to MEMS axis
Sample Data File:
$00FCCE00F13FFD78100910A811FA
$00FCDF00F13FFCD3141614C71619
$00FCD600F33FFD20182118E61A39
$00FCDA00F73FFB3E1C2D1D051E58
$00FCDD00F73FFC32203921242278
$00FCDD00EF3FFDDC244525442697
The vi and a longer sample data file are uploaded to the ni ftp site. The zip file is named: IMU (9-15-08).zip. (Can't attach files to this message for some reason)
Any help appreciated.
Thanks,
ChrisFiles uploaded to the "incoming" directory cannot be downloaded. That folder is intended to be used for submitting code to NI to investigate bugs and such things, not for forum posts.
What are you expecting FCCE to be? If the string is made of the characters "F", followed by the character "C", etc. (as opposed to the hex value of F, followed by the hex value of C, etc), then you can simply use Hexadecimal String to Number. Otherwise you need to use Type Cast.
Attachments:
Example_VI.png 5 KB -
Hi All,
A minor query about time stamps and scan from string. I needed to convert a string back to a timestamp and found the solution I needed at this post: Link
I wanted to make it a little more programatic and noticed that when I assembled the formatting string it would not recognise the assembled output as a Timestamp - it outputted a double. The strings inputs are identical. The double precision output converted to a Timestamp to give the correct value - so I have a work around.
I was just curious if this is a minor issue with LabVIEW or is this an intentional feature? Or is there some step I'm missing to coerce my output to a Timestamp.
Thanks,
Dave
Solved!
Go to Solution.I convert a string to a double represented as a timestamp. The strange is that it converts wrong, if I wire a 'NaN' to the default value. Look inside the code..
(LabVIEW 2010 SP1)
Attachments:
Untitled 1.vi 10 KB -
Hi Everybody,
I'm trying to use LabView to
process some data. The data, although it was collected via labview,
has been written out to csv file format. I have been able to
successfully open the file and use the search split string function to
remove the "header" from the data stream. Now I'm trying to parse the
header to extract some pieces of the info that is there. I'm trying to
do this with the Scan from String VI.
So
far I've been able to retrieve the Specimen ID from the first line of
the header by setting the format string input of Scan from String as
"Specimen ID ,%s", which works just fine. Problem is, when I
adjust
the format string to include the next piece of data I want, I
inevitably get an Error 85, which is a failed scan. In fact, I
get an err85 every time I try to extract something from after the
second line. I've attached a VI in which I cut and pasted an
example header string in as a string constant and an example of how I'm
trying to extract the values. I've tried playing around with
spaces and different formats, but get the err85 no matter what I do
(unless I extract the first line). I have a hunch that it has
something to do with the EOL marker, but no idea how to work around it.
A search of posts here show that a lot of people have issues with the
scan from string vi, but nobody I could find had this exact
problem. I've also considered using the spreadsheet spring to
array function, but because I have a mix of commas and EOLs it doesn't
seem to work either. HELP! I really don't want to have to write this
over in VBA/Excel.
Thanks,
Turk
Message Edited by YoungTurk on 07-29-2005 10:36 AM
Attachments:
Scan.vi 12 KBYou should probably parse it line by line (See attached, LabVIEW 7.1)..
The attached example shows one possibility to get all the Items and values out. Not all values are strictly numeric so you would need to adapt the code a little bit. (This is just a very rough 1 minute draft).
You might want to cosider to extract all values into a cluster for further processing, Have a look at the example posted in this thread . It can be easily adapted to read the values in the proper format (DBL, I32, Date, String, etc.) depending on the item name.
Good luck!
LabVIEW Champion . Do more with less code and in less time .
Attachments:
ScanMOD.vi 30 KB -
i all,
I'm trying to use Scan From String in order to parse some data coming in from UDP.
Input String: ASCII [00 01 02 03 ... FF]
What I want: s[00 .. 30] d[12], d[34], d[56] leftover s[37 38 39 ... FF]
ATTEMPT1
Format String: %49s%2d%2d%2d
What I get: s[00-09] RUNTIME ERROR!
ATTEMPT2
Format String: %49[^]%2d%2d%2d
What I get: Only allows first output. Will error out if I use any additional outputs from Scan From String
ATTEMPT3
Format String: %49[^(0xFF)]%2d%2d%2d Value in () is ASCII character FF.
What I get: s[00 .. 30] d[12], d[34], d[56] leftover s[37 38 39 ... FF]
It appears as though when I use %##[^] it thinks I'm looking for the ENTIRE string so it will not let me add any more Formatting. If I add a delimiter other than ^ it will run, and it will work presuming that character isn't within the first 49 characters... and I can't guarentee that it won't.
I'm aware I can parse my string using subsets and whatnot... but Scan From String is so elegant. It would be great if %S allowed for white space... or if $##[^] would simply take the first ## characters and allow me to Format after that.
Is there a simple, elegant way to do this? I wish my dataset was only 3-4 outputs. It'd be ideal if I could. Thanks.
Edit:
It might be more helpful if I provide a less abstract example:
I have an ASCII Header (Finite Length String), a Sender IP (Finite Length String), a Timestamp, a Message ID (Finite Length Decimal), A Message in ASCII ( '1' actually means 0x31, not 0x01) And for some ungodly reason... no delimiters.
So I was HOPING %##s%##s%<%H:%M:%s>t%##d (With leftover string to be my message) would work, but if any white space is contained within there... it messes up.I cannot provide exact strings because the string is actually ASCII characters, most of which aren't displayable.
I have a string where I have:
24 ASCII Characters representing 6x U32 Header Data
13 ASCII characters represening the sender IP (string)
12 ASCII Characters representing the name of the message (String)
12 ASCII Characters representing 3x U32 Data
12 ASCII Characters represneting the name of packet (String)
12 ASCII Characters representing 12x U8 Data
256 ASCII Characters represening 256x U8 Data
etc...
It would be ideal to simply Scan from the string and output the data with the appropriate data types already assigned instead of splitting string and type casting each individualy. But if, for example, my header starts with an ASCII representation of a U32 of 2560(decimal) it would look like this: [00][00][0A][00]. ASCII 0A is considered white space. So my header would only contain 2 ASCII characters instead of the desired 24. -
Hello.
I work with LV 7.1, with the I Modul of PDA.
It doesn't work me 'Scan From String'. I have not found any contradiction because the pda doesn't accept it.
Does somebody know which the cause can be? As I can substitute it?
Thank you.
Greta
Attachments:
scan from string.JPG 6 KBHello Greta
The Scan from string function is supported in LV PDA but with some restrictions. The help file for LV PDA tells us:
'The Format Into String function and the Scan From String function do not support changing the numeric separator (such as %#;). The Scan From String function does not support wildcard matches.'
You are changing the numeric separator and this is not supported.
Hope this helps
BelenS -
Wrong use of "Scan From String" function in a while loop?
Hi,
I've got a "Scan From String" function inside a while loop. On the first iteration it converts correctly the number passed by the input string (for example 4) But on the second one it has only spaces (one or more \s) as input string.
I expected to obtain a zero as output (as it does always that it can not make any conversions, as I am supposed to) but indeed, i subtracts 1 from the previous number (according to the number indicated as example I would obtain a 3 as output)
What's wrong with this?
Does the function fails on this case?
The rest of the diagram o the VI is expected to manage a 0 on that situation, like others in which the conversion is not made.
Andres.I have simplified the VI evading calls to other VIs and trying to reproduce the mistake.
The type of string I introduce to reproduce the mistake is:
clock 3 (30) clock (40)
Forgetting to introduce a number between the second "clock" and the following parenthesis, I would manage it programmatically with code that isn't included.
Then "Scan From String" is supposed to do not make a conversion. But it leaves a 2 as output (in this example)
I have realised, unbelievable but true, that it has matter with the number I substract to the output number (if it were 2, I would obtain 1 as output and so on)
Excluding that, I got the conversion made before as output, 3, on the second time that "Scan From String" executes. But, how can this func
tion as bad?
I am using LV4 on an old PC. I have tried to reproduce it with LV6 and it works. But it isn't desirable for me, I would have to convert a lot of VIs and surely I will find a lot of errors due to the conversion (I have already tried)
Attachments:
EXTCLOCK.VI 26 KB -
Scan from String (arg1) in TKTDS1k2K, Input parameter invalid
After calibration, i am getting a error about Command Requires GPIB controller to be controller in charge, and Scan from String (arg 1) in TKTDs1K2K scalewaveformarray.vi>scope_vppmeaurement.vi
LABVIEW: An input parameter is invalid.
NI-488: Commands Requires GPIB Controller to be in charge .
This program was working before 3rd party calibrated. Failing on first scope measurement. Passes Scope Setup.
Thanks from newbie scheduled a May Class.
Greg Shepherd
RUNNING tEST STAND & lABVIEW 8
GregOne additional note. I have not had to use Regular Expressions very much, so I'm somewhat of a novice. My FIRST attempt to match either the Verbose or Abbreviated commands from the DSO was as follows:
:WFMP.*:XZE.* $
In words, what I’m trying to say is, “Match any instance of “:WFMP”, followed by any number of any character, followed by “:XZE” followed by any number of any character, and ending with a Space character.” It sure seemed like that should work...but it did not within the VI. That was when I tried other options and found the longer, "A or B" type of match would work, as described in my previous post.
This morning, a buddy sent me links to a couple of websites where you can experiment with Regular Expressions and see if your input is getting matched correctly. By using one of those tools, it appears that my initial attempt IS VALID, but yet, it didn't work within LabVIEW (8.6 for me). I have read some other posts RE: "Bugs" within the way LabVIEW works with Regular Expressions, so maybe this is something similar. But at least I'm up and running by using the long-way. -
Hello, i have a problem with Labview 2013, on my pc(where i make the Vi from zero) work verry good, but when i put the Vi on laptop with the same version of labview, i get error from scan from string. hardware part are not changed, why i get this error? this is my VI.
Attachments:
Dc_motor_control2.vi 365 KBPut some probes or indicators to see what is being returned from the VISA Read. It could be a simple synchronization error. Try reading more bytes.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Get string inside brackets - Using Scan from string
I have a very basic question here. I would like extract a portion of a string which is inside brackets (Example: I work with [National Instruments]). In the string I only want to extract National Instruments, I do know logic to extract by finding the brackets and extracting them. But I am interested in using the Scan from string or possibly any other primitive in one shot. Please suggest if anyone has any idea, I am really not use to the format specifiers. I got this link for reference but I am not able to figure out a solution.
The best solution is the one you find it by yourself
Solved!
Go to Solution.Hi,
I cannot say that it is the best solution, I use two Scan From String functions instead of one but it does work, so far ;-)
I use Characters in set.
I could not attach VI so FP is below.
Duri
Maybe you are looking for
-
How to display the one BSP View page (not a start page)Through URL link..
Hi Sir/Madam, I want to open one BSP view page through URL link... Let me Explain clearly.. I have an Z application ZHRRCF_APPROVAL..In this application approve.bsp file i have added som more Fields..and Finally I am going to
-
Level(0) Function in MDX Queries
Hi All, SELECT ON AXIS(0), [Year].Levels(0).Members } DIMENSION PROPERTIES [LEVEL_NUMBER],[MEMBER_NAME] ON AXIS(1) FROM 'A_LvVFPT'.'Incstmt'; by using the above script i was getting Months for Jan, Feb.... Dec. Even though i changed the Qtr1 in
-
Working in background or staying focused
Im trying to create a simple program (mainclass extends Frame) that moves mouse to different parts of the screen when I press a key to reduce physical movement of mouse needed. I was able to do this with Robot, but I'm having problem with focus. When
-
Re-install software after upgrade to Snow Leopard ....
I upgraded to Snow Leopard and was not concerned about re-installing my original software because I had the discs. When it came time the installer asks for the serial # off of the original boxes that it came in .... I keep my discs in a binder and d
-
Hace unos dos días iMessage tanto desde mi iPhone y MacBook pro, han estado comportandose de manera extraña, no puedo mandar mensajes por iMessage, ni tampoco me llegan las personas que me los mandan, y si mando un mensaje de texto me cobran el envio