フィルターのクリア

Function that will select one of two data sets

1 回表示 (過去 30 日間)
Kevin Burg
Kevin Burg 2021 年 6 月 23 日
回答済み: Image Analyst 2021 年 6 月 23 日
I am trying to set up a function that will pick one of two data sets. If a set parameter is postive I want this to be from the first data set. If a set parameter is negative I want the second data set used. Here is basic structure of what I have so far but I do not think I have the logic correct.
function [ x y ] = donor( set_ind )
global vols sets
ind_first = sets.set_dat(set_ind).first;
ind_second = sets.set_dat(set_ind).second;
if z > 0
[ x y ] = ind_first;
elseif z < 0
[ x y ] = ind_second;
end
end

採用された回答

Image Analyst
Image Analyst 2021 年 6 月 23 日
Try
function [xy] = donor(setIndex)
global sets
if rand(1) > 0.5
xy = sets.set_dat(setIndex).first;
else
xy = sets.set_dat(setIndex).second;
end
end

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by