
Appending Values (string and variable) to a Table

viralvector
I successfully added the code into mine, but I would like to also add a text column corresponding to the value. How do I add another column to the table? If there is a better way to perform category plotting from the graph without use of table, the suggestion is also welcomed.
(currently, I used the function print to display the value of "tracename" and "ratioValue", then perform copy-past function to the table for category plotting. )
Menu "Ratiometric",dynamic TraceNameList ("",";",1), donor_acceptor() "Ratio all", donor_acceptorAll() End Function donor_acceptor() variable donor variable acceptor prompt acceptor,"Acceptor peak" Prompt donor,"Donor peak" Doprompt "Enter values", acceptor,donor if (V_flag == 0) ratiometric(donor, acceptor) endif end Function ratiometric(donor,acceptor) variable donor,acceptor GetLastUserMenuInfo // sets S_value, V_value, etc. ratiometric_value(S_value,donor,acceptor) end Function ratiometric_value(tracename,donor,acceptor) string tracename variable donor,acceptor wave w= traceNametowaveRef("",traceName) wavestats/q w variable xPeak = V_maxloc VARIABLE ratioValue = w(acceptor)/w(donor) //scale value indexing // VARIABLE ratioValue = w[acceptor]/w[donor] // point value indexing String TextItRatio sprintf TextItRatio, "\\Z09 \\K(0,65280,0)\\ON \rRatio=%g",ratioValue Tag /F=2/S=3/A=MT/B=(0,0,0) $tracename,xPeak, TextItRatio //Appending values to a table, found in igorexchange.com/node/4857 Wave/Z/D ratioValueTable // Look for ratioValue wave in current data folder if (!WaveExists(ratioValueTable)) Make/O/D/N=0 ratioValueTable endif Wave ratioValueTable Variable numPoints = numpnts(ratioValueTable) ratioValueTable[numPoints] = {ratioValue} // Add new point to integrals print tracename, ratioValue End Function donor_acceptorAll() variable donor variable acceptor variable ratioValue prompt acceptor,"Acceptor peak" Prompt donor,"Donor peak" Doprompt "Enter values", acceptor,donor if (V_flag == 0) ratiometricall(donor, acceptor) endif end Function ratiometricall(donor,acceptor) variable donor,acceptor variable ratioValue String list = TraceNameList("", ";", 1) String tracename Variable index = 0 do traceName = StringFromList(index, list) if (strlen(traceName) == 0) break // No more traces. endif ratiometric_value(tracename,donor,acceptor) index += 1 while(1) wave ratioValueTable edit ratioValueTable end Thank you!
Do you want a second column containing the ratios? That would work with
Edit LabelWave, ValueWave
or
If you want to concatenate both properties use
num2str
and "+"Labels=LabelWave+" "+num2str(ValueWave)
For testing:
Hope it covers your concern,
HJ
July 13, 2015 at 11:40 am - Permalink
I tried the following and I only get the first set of data.
string tracename
variable ratiovalue
.....
Make /N=2 /T NameofTrace={traceName}
Make /N=2 ratioTabe={ratiovalue}
edit nameofTrace,ratioTable
Any suggestions?
Thank you!
July 13, 2015 at 03:14 pm - Permalink
print tracename, ratioValue make me think you want one string for one pair of tracename and ratio combined in one text label.
create a text wave (Make /T) called "ratioValueLables" and change
ratioValueTable[numPoints] = {ratioValue}
to
There are more elegant ways to do something like this, but it is still not clear what you are about to do.
HJ
July 13, 2015 at 03:48 pm - Permalink
A. Obtaining ratio by B/A
B. Making table Name(a) <---> Ratio(a)
C. Plotting with category
I can obtain ratio value (ratioVAlue) and their name (tracename), but I struggled to plot them with one or two steps.
Can you point me to that direction?
Thank you!
July 14, 2015 at 09:46 am - Permalink
but I'm still not sure if this is what you want. Maybe you also want to have a look at
displayhelptopic "Tag"
HJ
July 14, 2015 at 10:44 am - Permalink
The detail:
First, what I want to do is to create a functions to measure a ratio from a lambda plot (a raw data format : intensity vs. wavelength).
To do this, I have to measure the ratio between lambda position at 580nm / 483 nm.
After obtaining the ratio (RatioValue in this case) by presenting in the same plot with tag operation.
Then I would like to create the bar chart with category plot. This is the step I struggle to transfer the values into category plot automatically.
Ultimately, I want to build a function to do the task with one step.
First, obtaining ratio value from raw lambda data
Second, automatically plot into category bar chart.
Does it clear to you? I really appreciate your helps.
July 14, 2015 at 01:04 pm - Permalink
It is ok that the LabelText wave gets overwritten each time.
HJ
July 14, 2015 at 02:21 pm - Permalink
July 14, 2015 at 02:53 pm - Permalink