Expected one output from a curly brace or dot indexing expression, but there were 12 results.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a table and want to plot cellcount (y) per radius(x). I want to say choose all "cellcount.perhexagon" at final time and plot it versus x.
I want to plot a figure and use this command:
plot(Acc_cellcount.radius(Acc_cellcount.time==data.timepoints.time(end))),cellcount.perhexagon(Acc_cellcount.time==data.timepoints.time(end)))
but I recieve above error. How can I make it to extract all "cellcounts" and "radisu" of the final time not single the end point?
4 Kommentare
Stephen23
am 29 Sep. 2019
Read these to know what your code is actually doing, and why the error occurs when you try to access the field time in the non-scalar structure data.timepoints:https://www.mathworks.com/matlabcentral/answers/320713-how-to-operate-on-comma-separated-lists|
Antworten (1)
Walter Roberson
am 29 Sep. 2019
Acc_cellcount.time is a column vector of values.
data.timepoints is a non-scalar array. data.timepoints.time asks for structure expansion, and nearly is the equivalent of writing
data.timepoints(1).time, data.timepoints(2).time, data.timepoints(3).time, .... data.timepoints(12).time
at that point. data(timepoints.time(end) is not permitted because () indexing of non-scalar structure expansion is not permitted. If it were permitted, your command would be something like
Acc_cellcount.time==data.timepoints(1).time(end),data.timepoints(2).time(end),data.timepoints(3).time(end)
and so on.
If you are trying to compare each entry in Acc_cellcount.time to the corresponding data.timepoints.time's last entry, then
tp_times = arrayfun(@(TP) TP.time(end), data.timepoints);
mask = Acc_cellcount.time == tp_times;
plot(Acc_cellcount.radius(mask)), cellcount.perhexagon(mask))
3 Kommentare
Walter Roberson
am 30 Sep. 2019
I wrote, "If you are trying to compare each entry in Acc_cellcount.time to the corresponding data.timepoints.time's last entry, then" but that does not appear to hold.
You have 179 time entries. You have 12 data.timepoints struct members, each of which has a time entry that is a vector of length not known to us .
It is not at all obvious how you want to compare the 179 entries to the 12 items each with a vector. Even if each of the vectors was length 15 exactly so that the 12 of them together added up to 180 entries, that would not match the 179 of the left hand side.
Is your question whether each of the 179 entries appears somewhere in data.timepoints.time ? Or is your question whether each of the 179 entries appears somewhere in the last element of each of the 12 data.timepoints time vectors (that is, the values now collected in the variable tp_times ?)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!