06-16-2021 02:07 AM
we will learn some cosmetics
Ex 3-1.5aa+3.5aa^2-1000aa^20
As soon as you run the program or click outside the input area the input equation must change its form
3-1.5aa+3.5aa²-1000aa²⁰
And as soon as you click back into the input region the equation must turn back like 3-1.5aa+3.5aa^2-1000aa^20
I need to do the task mentioned above.
In order to do so, I planned to replace ^ with \B(replace ^2 with \B2 and ^20 with \B2\B0) but
gets changed into
So I write \B in string constant and when I click outside that, I get \0B ( and his weird box when I set it to normal display).
I will appreciate any help in fixing this and also how to proceed ahead(i don't know how to make it work in the front panel) or if there is another way to this task and avoid the steps I was doing.
PS: I just started learning LabVIEW a couple of days ago, so, please explain the use of property node/ event structure /local variable or anything else we need in performing the above task.
Thanks a lot in advance.
Solved! Go to Solution.
06-16-2021 02:16 AM - edited 06-16-2021 02:21 AM
Hi ankitk,
@ankitk17 wrote:
So I write \B in string constant and when I click outside that, I get \0B ( and his weird box when I set it to normal display).
I will appreciate any help in fixing this and also how to proceed ahead(i don't know how to make it work in the front panel) or if there is another way to this task and avoid the steps I was doing.
PS: I just started learning LabVIEW a couple of days ago,
Did you notice those "Training resources" in the header of the LabVIEW board? There you can learn about all the basics of LabVIEW…
When I type "\B" in a string constant then it stays exactly like that when you click outside the string constant - atleast in "normal" display style!
However you seem to have changed the display style to "\-code" without making that visible in the string constant: now the behaviour changes a little bit and "\B" gets replaced by "\0B" (by design)…
Btw. why do you want to replace the caret by a VT ("vertical tab") control character? What do you want to achieve by the replacement? VT was used to move to the next line…
Idea: use a 2DPictureIndicator to draw your "cosmetically nice" formula…
06-16-2021 04:08 AM
Hello GerdW,
Thanks for a super quick reply,
I didn't notice those "Training resources", I started looking for them after reading your reply.
I hope you are talking about LabVIEW Core 1 - 2020 Course - NI.
or please let me know if you meant something else with a link to training resources.
Now as I mention in my question, I want to make 3-1.5aa+3.5aa^2-1000aa^20 look like aa3-1.5aa+3.5aa²-1000aa²⁰.
here is the same equation displayed in \codes form and normal form respectively.
So, what I was trying to do is find the start position and end position of exponents(2 and 20) and replace ^ and add \B so that ^2 and ^20 converts into ² and ²⁰ (or \B2 and \B2\B0 in \code format).
And then find a property node to change the equation as I was asked to do in the mentioned task.
I am new to it, so I am not sure that it will work like that or not. I just want to make aa^2 look like aa² when the cursor is not inside the box and convert it back to aa^2 when we click on it to edit it. But for this, we need to read and write the same string, and as of now, I don't have any idea how can I do so.
I don't know a thing about "2DPictureIndicator". But I will try to learn about it more and implement it if it can help me with my task. Please let me know if you have any reference material for this.
Again thanks for your time and advice.
Best regards
Ankit Kumar
06-16-2021 04:20 AM - edited 06-16-2021 04:25 AM
Hi Ankit,
@ankitk17 wrote:
So, what I was trying to do is find the start position and end position of exponents(2 and 20) and replace ^ and add \B so that ^2 and ^20 converts into ² and ²⁰ (or \B2 and \B2\B0 in \code format).
You didn't answer why you think the code "\B" will help you here? Can you supply a link to a website explaining the usage of that char?
How did you create the text in the "Equation 2" string?
What is the last char, which should be a "superscript zero"? It looks more like a "superscript lowercase o"…
@ankitk17 wrote:
please let me know if you meant something else with a link to training resources.
I meant the "Training resources" just in the top section of the LabVIEW board…
@ankitk17 wrote:
I am new to it, so I am not sure that it will work like that or not. I just want to make aa^2 look like aa² when the cursor is not inside the box and convert it back to aa^2 when we click on it to edit it. But for this, we need to read and write the same string, and as of now, I don't have any idea how can I do so.
I don't know a thing about "2DPictureIndicator". But I will try to learn about it more and implement it if it can help me with my task. Please let me know if you have any reference material for this.
Idea:
06-16-2021 04:57 AM
Hi GerdW,
How did you create the text in the "Equation 2" string?
-I just copy-pasted it.
why do you think the code "\B" will help you here?
-As I copy-pasted the equation, and viewed its \codes, I came to know that \B can be used to superscript any number, but I was wrong. I can only superscript no. 2 and no.3, for the rest of the numbers it shows some other characters and \B0 shows the degree symbol(i guess).
I was confused because \B2 was working fine for 2 and I thought this is how LabVIEW types superscripts 0.
After reading your recent reply I copied ¹²³⁴⁵⁶⁷⁸⁹⁰ and pasted, and this is what I got-
It was a coincidence that I was provided with numbers 2 and 0, I guess.
Thanks for the idea, I will try my best to use it how you suggested.
Best regards,
Ankit Kumar
06-16-2021 05:10 AM
Hi Ankit,
@ankitk17 wrote:
It was a coincidence that I was provided with numbers 2 and 0, I guess.
The only "coincidence" is the fact, that your computer uses the default (1252) Windows character table.
You are also confusing "\B" with "\B2":
06-23-2021 10:16 PM
Thanks for the information and idea, GerdW
But I was unable to use 2Dpicture to superscript the text(maybe my lack of knowledge), so I replaced it with a string indicator and it worked fine for me.
Here is the code attached.
Now my next step is to create different string indicators for a given array of Double complex numbers and remove the iota part from the string if a number is pure real and has no complex part. The number of string indicators must be smartly chosen, neither one less nor one more.
Thanks in advance.
Best Regards
Ankit kumar
06-24-2021 12:52 AM
Hi Ankit,
@ankitk17 wrote:
But I was unable to use 2Dpicture to superscript the text(maybe my lack of knowledge),
"Superscript" can be simplified by "using smaller font, move chars to top line of normal sized chars"…
@ankitk17 wrote:
array of Double complex numbers and remove the iota part from the string if a number is pure real and has no complex part.
A complex number always has an imaginary part…
06-24-2021 05:34 AM
Hi GerdW,
"Superscript" can be simplified by "using smaller font, move chars to top line of normal sized chars"…
-That's what I used for the string indicator, I used a different font for superscripts only. I don't know how to print different fonts on a 2D picture, so for the 2D picture, the coefficients are also getting superscripted. So I used a string indicator with 2 different fonts.
A complex number always has an imaginary part…
- I know this, but I just want x+0.00000i to look like x only, i.e. remove the 0.00000i part when it's 0. That's what I meant by saying a purely real number that doesn't have 0.00000i term.
I don't know how to create a specific number of string indicators(not an array of strings) for a given complex number array. Please help me with this.
I also want to know how to use this-
and this-
Best Regards
Ankit kumar
06-24-2021 06:43 AM
Hi Ankit,
@ankitk17 wrote:
I don't know how to print different fonts on a 2D picture, so for the 2D picture, the coefficients are also getting superscripted.
When using the DrawTextAtPoint function you can define the font, the font size and the position of the text…
@ankitk17 wrote:
I just want x+0.00000i to look like x only, i.e. remove the 0.00000i part when it's 0. That's what I meant by saying a purely real number that doesn't have 0.00000i term.
% checking absolute value of imaginary part of complex number
IF abs(im(complex)) < 1e-6 THEN
FormatIntoString(re(complex))
ELSE
FormatIntoString(complex)
ENDIF
@ankitk17 wrote:
I don't know how to create a specific number of string indicators(not an array of strings) for a given complex number array.
Why do you need so many string indicators?
(You can create as many as needed at edit time of your VI…)