How to write a for loop ?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to write a for loop that extracts a label out of a variable that i have labeled marker_labels_single. I then need it to create a new label that adds _x, _y, _ z to the end of the label. I truly have no idea how to do this
댓글 수: 0
답변 (1개)
Walter Roberson
2022년 11월 2일
marker_labels_single = {'peppers', 'moths', 'grues'};
xlabels = marker_labels_single + "_x"
ylabels = marker_labels_single + "_y"
zlabels = marker_labels_single + "_z"
댓글 수: 2
Walter Roberson
2022년 11월 6일
for K = 1 : length(marker_labels_single)
labels = marker_labels_single{K} + "_" + ["x" "y" "z"]
end
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!