Plotting doubles against cells
2 次查看(过去 30 天)
显示 更早的评论
I have 36 cells in the cell array AAG(36x1) A cell looks like this:
AAG{3,1}=1x923 cell={1x757 double 1x726 double 1x761 double 1x785 double 1x773 double 1x788 double...}
For each double, I have one value in another cell array AAI(36x1)
AAI{3,1}=1x923 double=[8 11 8 11 8..7...]
What I want is to plot AAI against AAG.
I have tried using 2 functions and for loops to make to column vectors with all values in AAG plotted against the values in AAI repeated .
4 个评论
Turlough Hughes
2021-4-28
Ok that helps, my follow up question is how does the data in AAG{3,1} relate to AAI{3,1}, are you expecting 923 horizontal lines for AAG{3,1} and AAI{3,1}? Do you want to plot it all on the same chart?
采纳的回答
Turlough Hughes
2021-4-28
编辑:Turlough Hughes
2021-4-28
Here's an example, i've used X and Y in place of AAG and AAI to simplify:
% example data
X = arrayfun(@(x) cell(1,randi(1000,1)),1:36,'uni',false).'; % for AAG
Y = arrayfun(@(x) rand(1,numel(X{x})),1:36,'uni',false).'; % for AAI
for ii = 1:numel(X)
X{ii} = cellfun(@(x) randi(1000,[1 randi(100)]),X{ii},'uni',false);
end
So X is a 36 by 1 column of cells, where each cell contains a row of cell, each of which contains several row vectors of numeric data. Each of the numeric row vectors comprise the x data that you want to plot at a single height, y for that row of data. For each row of cells contained in the 36 cells in X, there is a corresponding numeric row vector contained in the cells of Y with equal size indicating the heights for each line.
To plot results for X{3,1} you could do the following:
ii=3;
figure(), hold on,
arrayfun(@(idx) plot(X{ii}{idx},repmat(Y{ii}(idx),[1 numel(X{ii}{idx})]),'.') ,1:numel(Y{ii}))
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Create Fixed-Point Objects in MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!