how to draw line from first element of cell array to same cell array but fliplr first element and soon
1 次查看(过去 30 天)
显示 更早的评论
how to take the first element from two cell array in single for loop
2 个评论
Star Strider
2015-4-26
How do you create your ‘CHM’ cell array?
Your code is displaying the first 6 elements of it.
Star Strider
2015-4-26
NOTE: This was not the original question (so those of us who Answered it are not as delusional as it might seem from reading our Answers).
The new question is correctly (and more understandably) stated in: how to draw a line from one plotted node to another ploted node.
采纳的回答
Star Strider
2015-4-26
编辑:Star Strider
2015-4-26
This is the easiest way to do what I believe you want:
CHM = {[] [] [17] [] [6,11] [1 9]};
A = CHM(cellfun(@(x) ~isempty(x), CHM));
A{:} % Display Contents Of ‘A’
produces:
ans =
17
ans =
6 11
ans =
1 9
EDIT: Added results of displaying ‘A’
9 个评论
dpb
2015-4-27
After the above (SS's solution) for A then it's simply
A=[A(:)]; % convert A cell array to row vector, NB: SS leaves as cell
B=fliplr(A); % now reverse for B
C=A; % make two copies (or assign C, D instead of A,B above)
D=B;
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!