Transform char variable to matrix
조회 수: 17 (최근 30일)
이전 댓글 표시
Hi, I have a cell variable that looks like this:

I'D like to know if there is a way to transform it into a matrix of this kind:
NewVar=[2 5; 2 3; 2 5];
Thanks
댓글 수: 0
채택된 답변
Walter Roberson
2020년 2월 14일
tmp = {'002,005';'002,003';'002,005'};
NewVar = cell2mat(cellfun(@(S) sscanf(S, '%f,%f').', tmp, 'uniform', 0));
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!