How to plot cell array data?
2 次查看(过去 30 天)
显示 更早的评论
I'm trying to plot the contents of a cell array (RSD_c{v}) composed of 5 32x3 double matrices. I want each column to be the X,Y,and Z variable, respectively.
if true
%Plot bias vs. B vs. v
%bias, B, and v contained in RSD_c(:,1), RSD_c(:,2), and RSD_c(:,5), respectively
figure;hold on;
cellfun(@scatter3,RSD_c(:,1),RSD_c(:,2),RSD_c(:,3));
end
When I run the above code,I get the error, "??? Error using ==> scatter3 at 63 X, Y and Z must be vectors of the same length."
What am I doing wrong? How do I fix this?
0 个评论
回答(1 个)
Adam
2016-8-11
cellfun( @(x) scatter3( x(:,1), x(:,2), x(:,3) ), RSD_c )
should work, though I haven't double-checked the syntax in Matlab itself.
doc cellfun
should give examples of this syntax for calling.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!