??? In an assignment A(I) = B, the number of elements in B and I must be the same.

9 ビュー (過去 30 日間)
Ruben Wulms
Ruben Wulms 2012 年 3 月 12 日
I have to write a program for school that can read the temperture in a rooftile dryingroom. A NTC will be connected to a data-acquiring card. but when I want to use formulas on the whole matrix this creates is gives the before stated error. Below is the relevant code (the last 2 lines produce the error):
...
s=daq.createSession('ni');
s.addAnalogInputChannel('dev1',0,'Voltage');
s.Rate=rate;
s.DurationInSeconds=tijdseenheid;
[data,time]=s.startForeground;
...
const_a=input('The value of consistant A: ');
const_b=input('The value of consistant B: ');
weerstand=input('The value of the resistor: ');
ubron=input('The value of the powersupply: ');
data(:)=((ubron-data)*weerstand)/data;
data(:)=const_b/log((data)/const_a);
...
  1 件のコメント
Jan
Jan 2012 年 3 月 12 日
The error cannot be produced by two lines. Only one command can cause the error - afterwards Matlab stops.

サインインしてコメントする。

回答 (1 件)

Tom
Tom 2012 年 3 月 12 日
I'm not entirely sure what the variables are, but you may be meaning to do an element-by-element divide, not a matrix divide: in this case use ./ not / to divide.
  2 件のコメント
Ruben Wulms
Ruben Wulms 2012 年 3 月 12 日
We tried that but that also doesn't help.
We indeed try to put each element from the data matrix into the formula.
Jan
Jan 2012 年 3 月 12 日
You definitely need the elementwise operators. If you've tried this already without success, post your trials here.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by