Variable into block "from workplace"
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Davide Ferraro
2011-2-15
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 个评论
更多回答(4 个)
Kaustubha Govind
2011-2-15
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!