save data in a tabel with some column

Hello... :) I want to save a data from 2 textfields.. 1st textfield, save data as "X" 2nd textfield, save data as "Y"
How i can save them in a tabel, that have 3 columns..?? 1st column show the number series.. 2nd column show value of "X" 3rd column show value of "Y"
Like this..
----------------------
| No | X | Y |
----------------------
| 1. | 64 | 76 |
| 2. | 45 | 12 |
etc
Thank You before... :)

3 件のコメント

Ilham Hardy
Ilham Hardy 2012 年 5 月 15 日
What is textfields mean exactly?
Is the textfields from GUI?
Walter Roberson
Walter Roberson 2012 年 5 月 15 日
Is this table to be displayed on the command window (as text) or in a file (as text), or are you using a uitable() ?
Rahma Yeni
Rahma Yeni 2012 年 5 月 15 日
@ Ilham...
the textfields are from GUI
@ Walter...
I want the table only save by mat-file..
Example: I call the table is "Distance"
So, the table Distance, have 3 columns:
Serial Number ; X ; Y.
Is that possible Mister..??
Thank You.. :)

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

回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2012 年 5 月 15 日

0 投票

data = ...
dataset({[64, 76; 45, 12],'X','Y'},'ObsNames',cellstr(num2str((1:2)','%-d.')))
OR
dataset({[(1:2)',[64, 76; 45, 12]],'Serial_Number','X','Y'})

3 件のコメント

Rahma Yeni
Rahma Yeni 2012 年 5 月 15 日
Thank you Andrei.. :)
I have tried the 2nd function...
But i want make it in a table like mat-file..
and the data is continues.. so i can input the data repeated..
Walter Roberson
Walter Roberson 2012 年 5 月 15 日
.mat files are binary files and are not any particular shape... definitely not "table like".
MATLAB numeric matrices cannot have column headers or row headers.
Rahma Yeni
Rahma Yeni 2012 年 5 月 15 日
@ Walter..
Thank you before Sir..
If the column headers cannot change,, but i want to show the data to different column without column name,, it is not possible too..??
Do you have other solution for my problem..??
Thank you.. :)

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

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

質問済み:

2012 年 5 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by