フィルターのクリア

How to write a for loop ?

5 ビュー (過去 30 日間)
Amanda
Amanda 2022 年 11 月 1 日
コメント済み: Walter Roberson 2022 年 11 月 6 日
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

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 11 月 2 日
marker_labels_single = {'peppers', 'moths', 'grues'};
xlabels = marker_labels_single + "_x"
xlabels = 1×3 string array
"peppers_x" "moths_x" "grues_x"
ylabels = marker_labels_single + "_y"
ylabels = 1×3 string array
"peppers_y" "moths_y" "grues_y"
zlabels = marker_labels_single + "_z"
zlabels = 1×3 string array
"peppers_z" "moths_z" "grues_z"
  2 件のコメント
Amanda
Amanda 2022 年 11 月 6 日
I need it to look like peppers_x , peppers_y, peppers_z and so on for each label. I also want to put in a for loop
Walter Roberson
Walter Roberson 2022 年 11 月 6 日
for K = 1 : length(marker_labels_single)
labels = marker_labels_single{K} + "_" + ["x" "y" "z"]
end

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by