Arithmetic in Cell Arrays
이전 댓글 표시
I have the following variables in Cell arrays. b_x{k}, x{k}, c{k}.
I want to perform the following operation within the cell array.
D{k} = sqrt((b{k} - x{k}).^2 + (c{k}).^2)
When doing this I realize that these arithmetic operations cannot be done through a cell array. So do I have to do it using generalized operations such as gadd, gsubtract etc? If yes then for the element wise square should I use 'gmultiply' twice? Is there no other way?
Thanks
채택된 답변
추가 답변 (1개)
Image Analyst
2013년 11월 11일
0 개 추천
Try using cell2mat(), or just avoid using cell arrays and use numerical arrays in the first place. Why do you need cell arrays? Are you storing mixed data, such as numbers with an associated string?
댓글 수: 3
CX
2013년 11월 11일
Image Analyst
2013년 11월 11일
That is not a reason for using cell arrays. You can use regular arrays for b, x, and c, though if they have different lengths in each folder then D will have to be a cell array. Please give an example of them for two different folders.
CX
2013년 11월 11일
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!