Matrix Manipulation in Simulink

2 vues (au cours des 30 derniers jours)
Daniel
Daniel le 18 Fév 2011
Anyone here know how to edit data in a matlab 2D array (table).
I created a table using the xlsread command but now i want to write a function that can edit that array. I want to do this in simulink but can't seem to find a block that can do this.

Réponse acceptée

Daniel
Daniel le 24 Fév 2011
Thanks for the useless answers.
I figured it out, there are two ways to edit a table. You can use embedded matlab function like this:
function y = WriteToArray(u,row,column,replacement); %#eml; u(row,column) = replacement; y = u;
or you can simply use the Assignment Block.

Plus de réponses (3)

Paulo Silva
Paulo Silva le 19 Fév 2011
1) Build a GUI, you could just use guide, drag one uitable inside of the GUI, a button to load data and another to save data. MATLAB Basics: Adding a table to a GUI
2) In simulink place an annotation (double click on the background and write something), now press on it with the mouse right button and go to annotation properties, now just put the name of the GUI in ClickFcn, now when you want to edit the array just click on that annotation.

Daniel
Daniel le 20 Fév 2011
I need to be able to edit the table (2d array) in simulink because this application will essentially end up in an embedded target. So i need to programmatically edit the table in simulink.

Kaustubha Govind
Kaustubha Govind le 22 Fév 2011
I'm assuming that by "edit", you really mean "manipulate". If you've read the data from Excel into a MATLAB workspace variable, you can load it into Simulink using a Constant block and enter the matrix variable name for value.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by