Error in using variable from MATLAB workspace to Simulink?
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.
Si è verificato un errore
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
0 voti
Condividi un link a questa domanda
Risposta accettata
0 voti
Condividi un link a questa risposta
- it is a signal, just a constant signal; in that case use 0 as the first column (time); and configure From Workspace to "hold" the signal; OR
- it is something you want to treat as a global variable or datastore variable; OR
- it is something you want to use as a parameter (for example gain for a block)
14 Commenti
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
- know the complete paths to all occurances of the constant block that should use the same value, and set_param() each of them to the new numeric value; or
- define the value of the constant blocks in terms of a name, and use the kinds of techniques I linked to in order define the name as a param (in which case you do not need to know the paths to any blocks)
Condividi un link a questo commento
- run simulation and send Fs to workspace
- from Fs compute the value of a new variable called avg_rocof
- run the simulation again using the value of avg_rocof
Condividi un link a questo commento
- There is no need to mention global variable or datastore variable.
- There is no need to mention set_param(). The need for it would be the same, if using Constant block or "From Workspace" block.
- There is no need to explain the difference between "push" and "pull", if there are any.
- Signal object is irrevelant. It is used to define signal property, not to import value.
Condividi un link a questo commento
Condividi un link a questo commento
- Open simulink
- Create a blank model
- Create a block diagram with a Constant block feeding a To Workspace block
- Double click the Constant block, specify cvalue as the block parameter for "Constant value"
- Click OK on the Block Paramters for the Constant block
- At the matlab command prompt, assign a value to cvalue ">> cvalue = 6.23"
- Simulate the model by clicking the Run button
- After the simulation is complete, what does this command show: >> out.simout.Data
Condividi un link a questo commento
Condividi un link a questo commento
- Regarding auto prompt to create variables, (e.g. in R2022b)
- Regarding workspace
- Regarding Simulink fundamentals document
Condividi un link a questo commento
Condividi un link a questo commento
Più risposte (1)
0 voti
Condividi un link a questa risposta
3 Commenti
Condividi un link a questo commento
Condividi un link a questo commento
Categorie
Scopri di più su Event Functions in Centro assistenza e File Exchange
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!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)
