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!