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!