Variable into block "from workplace"
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I have one little question about block "from Worksplace". I want to put a variable data to a Embedded matlab function, and then to a Scope.
But, when I define my data like that (in the workplace) :
data = 1:10;
I have this error :
"Invalid external input specified. The input has 10 data columns while the sum of the port widths of all inports in the model is 1."
For example, I want my variable data change like that : data (time = 1) = 1, data (time = 2) = 2 etc.
How can I do this ?
Thanks !
0 comentarios
Respuesta aceptada
Davide Ferraro
el 15 de Feb. de 2011
From Workspace block should have a first column representing time and then your data columns. This should work fine:
data = [(1:10)',(1:10)'];
or using REPMAT:
data = repmat((1:10)',1,2);
0 comentarios
Más respuestas (4)
Kaustubha Govind
el 15 de Feb. de 2011
1) Yes. Essentially, the data defined in Davide's answer looks like this:
data =
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
Where the first column is time and second column is data. So you can write:
data = [[1:10]',[1 5 4 2 5 6 7 2 -1 7]'];
Or any arbitrary data in the second column.
3) I'm not sure what you mean by "more than one data", but you should find more information at the documentation page for From Workspace.
0 comentarios
Ver también
Categorías
Más información sobre String en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!