A vector with interchangeable numbers?
Afficher commentaires plus anciens
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 commentaire
José-Luis
le 11 Sep 2017
I don't get it. What's wrong with a logical array? What are these rules?
Réponses (0)
Catégories
En savoir plus sur Multidimensional Arrays dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!