{"id":2475,"date":"2023-03-30T06:26:33","date_gmt":"2023-03-30T06:26:33","guid":{"rendered":"https:\/\/35.94.173.37\/blog\/?p=2475"},"modified":"2025-02-03T16:16:37","modified_gmt":"2025-02-03T16:16:37","slug":"can-chatgpt-write-code-for-labview","status":"publish","type":"post","link":"https:\/\/www.apexwaves.com\/blog\/can-chatgpt-write-code-for-labview\/","title":{"rendered":"Can ChatGPT Write Code for LabVIEW?"},"content":{"rendered":"\n<figure class=\"wp-block-audio\"><audio controls src=\"https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/Can-ChatGPT-write-code.mp3\"><\/audio><figcaption class=\"wp-element-caption\"><strong><em>Listen to this post here ^<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p class=\"has-text-align-left\">This is undoubtedly not the first blog post or article about ChatGPT that you have read. Since its initial release just a few months ago in November 2022, Open AI\u2019s massive language model has exploded in popularity. The possible applications for ChatGPT seem endless, and companies and individuals alike are asking the fill-in-the-blank question with a million answers: \u201cCan ChatGPT help me ____<strong><em>_<\/em><\/strong>?\u201d.<\/p>\n\n\n\n<!--more-->\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-left\"><strong>EDITOR\u2019S NOTE<\/strong>:&nbsp;<em>Since the publication of this blog post, NI announced its newest AI assistant,&nbsp;<strong>NIGEL<\/strong>, at NI Connect 2023. NIGEL is made for coding within LabVIEW, and is capable of controlling hardware and creating graphical code. Learn more about it in our&nbsp;<a href=\"https:\/\/www.apexwaves.com\/blog\/ni-connect-keynote-recap-day-2\/\">Day 2 Keynote blog post<\/a>.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-left\">While ChatGPT is connected to the internet in order to receive and send information, it cannot perform searches in real-time as a search engine can. Instead, it relies on user input data to \u201ctrain\u201d it on a variety of subjects. ChatGPT Plus is the current, paid version of the module- and it uses the more advanced GPT-4, which was trained using Microsoft Azure AI Supercomputers. Because of the exponential influx of user activity since its release, ChatGPT\u2019s knowledge is vast\u2026 but it is far from perfect.<\/p>\n\n\n\n<p class=\"has-text-align-left\">To be clear, ChatGPT\u2019s abilities are nothing short of amazing. It is eloquent with its responses and it is capable of conversation eerily similar to a human. The accuracy of its general knowledge is incredibly helpful when trying to find a quick answer. However, the true strength of ChatGPT lies in its use as a tool, not as a solution. With the right queries and direction, the language model is capable of providing an incredible starting point for almost any project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-text-align-left has-black-color has-text-color\">ChatGPT and LabVIEW<\/h2>\n\n\n\n<p class=\"has-text-align-left\">One of the biggest hurdles users face with their NI hardware is coding LabVIEW programs to execute tests. Since ChatGPT boasts programming and coding skills as one of its useful strengths, many people have been putting it to the test with a variety of coding languages.<\/p>\n\n\n\n<p class=\"has-text-align-left\">With its graphical user interface, LabVIEW brings a unique challenge to the text-based ChatGPT. When we asked if it could write some code in LabVIEW for us, it initially gave us two examples of common LabVIEW programming tasks. (<em>Note: all of our interactions with ChatGPT for this post were made using the free version, ChatGPT-3.5<\/em>).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/ChatGPT-Reading-a-Sensor.png\" alt=\"Screenshot of ChatGPT explanation of the steps for reading data from a sensor using LabVIEW\" class=\"wp-image-1949\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/ChatGPT-Controlling-a-Motor.png\" alt=\"Screenshot of ChatGPT explanation of the steps for controlling a motor using LabVIEW\" class=\"wp-image-1950\"\/><\/figure>\n\n\n\n<p class=\"has-text-align-left\">As to be expected, ChatGPT does well when answering with information from well-documented procedures such as the ones above. But how would it do with writing actual code?<\/p>\n\n\n\n<div class=\"is-layout-constrained wp-block-group\">\n<div class=\"wp-block-group__inner-container\">\n<p class=\"has-text-align-left\">To find out, we ran a brief test. As with every good experiment, we had a control group. We used a snippet of some C code to read voltage from a DAQ device in LabWindows\/CVI. It looked like this:<\/p>\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1968\" src=\"https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-30-153715-1.png\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" srcset=\"https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-30-153715-1.png 704w, https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-30-153715-1-294x300.png 294w\" alt=\"\" width=\"840\" height=\"858\"><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p class=\"has-text-align-left\">We asked ChatGPT to write some code for the same purpose, using the inquiry \u201ccan you write code for reading voltage from a data acquisition device in LabWindows\/CVI?\u201d. The response was completely confident. This is what ChatGPT\u2019s code looked like:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-30-153809-1.png\" alt=\"\" class=\"wp-image-1969\"\/><\/figure>\n\n\n\n<p class=\"has-text-align-left\">A few noticeable differences right off the bat, but would it run? We ran it through LabVIEW to see if it would work.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/LabVIEW-Error-1024x555.png\" alt=\"Screenshot of LabVIEW screen showing an error in the code\" class=\"wp-image-1948\"\/><\/figure>\n\n\n\n<p class=\"has-text-align-left\">The first error the code ran into was trying to locate the nonexistent \u201cmodules.h\u201d file. We removed the \u201c#include\u201d command for that file to see what would happen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.apexwaves.com\/blog\/wp-content\/uploads\/2023\/03\/LabVIEW-Mulitple-Errors-1024x556.png\" alt=\"Screenshot of LabVIEW screen showing many errors in the code\" class=\"wp-image-1947\"\/><\/figure>\n\n\n\n<p class=\"has-text-align-left\">The result? Even more errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-align-left has-black-color has-text-color\"><strong>Conclusion<\/strong><\/h3>\n\n\n\n<p class=\"has-text-align-left\">Clearly, our experiment was a quick one. We could spend much more time testing different queries, clarifying with more information, or even continuing the conversation with ChatGPT and asking for specific fixes, possibly leading to a different result. However, the conclusion would most likely remain the same: ChatGPT is an amazing tool, but it must be utilized correctly. The code ChatGPT gave us, while imperfect, would have saved us a lot of time and given us a major head start in our programming endeavors- but it takes knowledge of what went wrong to address the issues.<\/p>\n\n\n\n<p class=\"has-text-align-left\">While ChatGPT provides unprecedented levels of competence, it is not a replacement for human understanding. While it may not (yet) be a threat to a programmer\u2019s job title on its own, it can certainly be an incredible asset for debugging, troubleshooting, or saving valuable time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is undoubtedly not the first blog post or article about ChatGPT that you have read. Since its initial release just a few months ago in November 2022, Open AI\u2019s massive language model has exploded in popularity. The possible applications for ChatGPT seem endless, and companies and individuals alike are asking the fill-in-the-blank question with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2476,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[8,10],"tags":[35,119,170,318,322,393,567],"class_list":["post-2475","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-national-instruments","category-technology","tag-ai","tag-chatgpt","tag-daq","tag-labview","tag-labwindows-cvi","tag-national-instruments","tag-programming"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/posts\/2475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/comments?post=2475"}],"version-history":[{"count":8,"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/posts\/2475\/revisions"}],"predecessor-version":[{"id":2938,"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/posts\/2475\/revisions\/2938"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/media\/2476"}],"wp:attachment":[{"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/media?parent=2475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/categories?post=2475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.apexwaves.com\/blog\/wp-json\/wp\/v2\/tags?post=2475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}