Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Al momento, stai seguendo questa domanda
- Vedrai gli aggiornamenti nel tuofeed del contenuto seguito.
- Potresti ricevere delle e-mail a seconda delle tuepreferenze per le comunicazioni.
how to write code to ceate population of individuals that has three parameters namely location, type of equipment and it rating
1 Commento
Risposte (1)
15 Commenti
No, the first form I gave creates one individual in the population, with each individual having 4 locations and 4 types and 4 rates. The second form I gave, with the loop, creates 4 individuals.
I specifically asked you "How many FACT are to be generated?" and you did not answer that clearly. If the answer is 100, then
for K = 1 : 100 FACT(K) = struct('location', randi(13,1,4), 'type', randi(4,1,4), 'rate', rand(1,4)); end
If you need this more clearly:
locations_per_FACT = 4; number_of_types = 4; number_of_locations = 13; population_size = 100;
for K = 1 : population_size FACT(K) = struct('location', randi(number_of_locations,1,locations_per_FACT), 'type', randi(number_of_types,1,locations_per_FACT), 'rate', rand(1,locations_per_FACT)); end
Question: do the locations need to be different for any given FACT ? If they do then:
locations_per_FACT = 4; number_of_types = 4; number_of_locations = 13; population_size = 100;
for K = population_size : -1 : 1 FACT(K) = struct('location', randperm(number_of_locations,locations_per_FACT), 'type', randi(number_of_types,1,locations_per_FACT), 'rate', rand(1,locations_per_FACT)); end
I can see from the diagram that the types can be duplicates within any one FACT.
Vedere anche
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Si è verificato un errore
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia-Pacifico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)