concatenating a string?
coltblaze
Can we concatenate a string with other string or with any value?
i have a folder which stores my waves which are named with the help of this command UniqueName("Wave",1,0) and after some personalizing i have made a function which plots the graph in host panel with NewImage /Host=# root:folder1:'Filename'
but i am controlling the files to select using panel to select which wave to plot an image for;
controlInfo provides me the wave number
and accordingly my Filename should be something like this Filename=Wave+V_Value
how can I pass it to the NewImage/Host=# root:folder:'Fiilename'
You can concatenate strings by just adding strings together:
String combined = "Hello" + " " + "World"
This can also be used to add strings from a (user or built-in) function which outputs strings:
String combined = "Hello World" + ", version " + num2str(2)
I guess, that you need something like:
String Filename = nameofwave(myinputwave) + num2str(V_Value)
For more information you might want to read:
DisplayHelpTopic "Working With Strings"
You then may need the $ symbol to convert a string to a reference for use as literal name, but I am not completely sure where you want to use this. Do you want to generate a name which can identify some host window? There might be better ways to do this like, for example, working with a generated list of open windows or directly from the calling function if it is a control within said window.
September 6, 2018 at 01:31 am - Permalink
In reply to You can concatenate strings… by chozo
[quote=chozo
I guess, that you need something like:
Wave myinputwave
String Filename = nameofwave(myinputwave) + num2str(V_Value)
[/quote]
Yes this might help thanks
September 6, 2018 at 01:44 am - Permalink