フィルターのクリア

Create a Table with column vectors

64 ビュー (過去 30 日間)
oselu
oselu 2014 年 8 月 11 日
回答済み: Image Analyst 2014 年 8 月 11 日
Hello I would like to create a table showing the power out put from a 0 to 200 volts column vector. In this table I would like to display:
  1. Power
  2. current
  3. voltsandI would like to name the table and each column.I tried to use the table function but it doesnt seem to workI am using matlab 7.10.0(R2010a)
  3 件のコメント
oselu
oselu 2014 年 8 月 11 日
I tried to make a matrice with letters in the first row(a-d) and in the second row(1-4). the letters come up but the numbers dont show until i put them in-between '..'
Adam
Adam 2014 年 8 月 11 日
Yeah, mixing strings and numbers together in a single matrix won't work.
I guess you could create a struct (or a class which I would always favour, but maybe not in R2010) with fields 'Power', 'current' and 'volts' then your "table" would be an array of members of that struct.
Searching the table and doing operations on it will be a lot less neat than with the new Table functionality, but again it depends a lot what you want to do with your table data after creating it as to what kind of data structure is best.

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

回答 (2 件)

Kevin Claytor
Kevin Claytor 2014 年 8 月 11 日
The table data type is R2013b and above. If you upgrade, you can do something like:
volts = [1:100]';
current = sin(linspace(0,2*pi))';
pt = array2table([volts, current], 'VariableNames', {'Volts', 'Current'})
pt.Power = pt.Volts .* pt.Current
plot(pt.Power)
If you can't upgrade, you can still use the struct data type:
volts = [1:100]';
current = sin(linspace(0,2*pi))';
pt = struct('Volts', volts, 'Current', current);
pt.Power = pt.Volts .* pt.Current;
plot(pt.Power)
They look almost the same, but there are some differences in the functionality.

Image Analyst
Image Analyst 2014 年 8 月 11 日
The "table" data type was not invented yet in your version. Upgrade if you can. Or else maybe you can put a uitable control on your GUI with uitable() or with the GUIDE gui editor tool http://blogs.mathworks.com/videos/category/gui-or-guide/.
To send data into the uitable, make up an array and use set():
set(handles.uitable1, 'Data', yourArray);

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by