Closed jotruebl closed 7 years ago
In that particular example you might want to use | instead of &, as you end up with an empty susbet here (chemicalSpecies can't be Propenal and PFBHA at the same time!). Still I make an internal note of maybe catching that type of error to warn the user that they have an empty subset.
Thanks for the rapid response!
I actually tried | earlier and it didn't seem to work:
g=gramm('y', allData.ExcelExp_Short_ID12.intensities, 'x', allData.ExcelExp_Short_ID12.chemicalSpecies, 'color', allData.ExcelExp_Short_ID12.sampleName,'subset',allData.ExcelExp_Short_ID12.sampleNum <9 | allData.ExcelExp_Short_ID12.sampleNum >3 )
The result was that it simply ignored the subset indicator and plotted everything.
You need to understand how these type of boolean operators work with each other and how logical arrays in Matlab work (not a gramm problem anymore ;) )... For your example you want samplenum>3 AND samplenum <9 AND (species == Propenal OR species == PFBHA)
Ah okay. I'll read up on it. Thanks again for your guidance. :)
Edit: Your hint helped me out a ton. I got it to work. Thanks again!
Hi. I'm not sure if I'm doing this wrong or if it's a bug (probably the former).
I am trying to choose multiple subsets:
g=gramm('y', allData.ExcelExp_Short_ID12.intensities, 'x', allData.ExcelExp_Short_ID12.chemicalSpecies, 'color', allData.ExcelExp_Short_ID12.sampleName,'subset',allData.ExcelExp_Short_ID12.sampleNum <9 & allData.ExcelExp_Short_ID12.sampleNum >3 & allData.ExcelExp_Short_ID12.chemicalSpecies =="Propenal" & allData.ExcelExp_Short_ID12.chemicalSpecies =="PFBHA")
As you can see, I want to plot sample numbers between 3 and 9 and only the data from Propenal and PFBHA. If I choose to only plot "Propenal" it works fine. But when I add PFBHA as a second x category, I get the following error:
Error using cellfun Input #2 expected to be a cell array, was double instead.
Can you assist with this? Perhaps even an explanation of the syntax for subset selection?
Thanks in advance!