A vector with interchangeable numbers?

I am trying to make a vector with 10 individual numbers. These numbers can be either 1 or 0 as 'yes' or 'no'. The probability of it being a yes or a no will be dependant on many other probabilities I will be factoring in, but how can I build this initial set that won't deviate from the initial rules? I will always be working with this vector but changing around the probabilities. I see a number of methods to achieve this, but there must be a single best way. I am currently writing this initial vector as a script and will incorporate the other rules as individual scripts. Examples of what I have already made are;
clear all; % Clear the workspace
clc; % Clear the command window
ev = [0 0 0 0 0 0 0 0 0 0];
evA = categorical(ev,[1 0],{'international','domestic'});
But this is just for categories?
Or cell arrays?
c = cell(1,10)
c = [] [] [] [] etc
deal function
[c1{0-1]} = deal (0)
and then I can refer to the vector as a whole (c1-c10) or individually (c1)??
There must be a better way?! Thanks!

댓글 수: 1

José-Luis
José-Luis 2017년 9월 11일
I don't get it. What's wrong with a logical array? What are these rules?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품

질문:

2017년 9월 11일

댓글:

2017년 9월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by