I am using tdfread to open a file and assign variable names. Is there a way to pick off the filename when the selecting the file? I would like to add the file name to the title of a plot.
Thanks.
Brian

回答 (2 件)

KL
KL 2017 年 10 月 24 日
編集済み: KL 2017 年 10 月 24 日

0 投票

use
filename = uigetfile
then for the title of the plot,
title(filename)

5 件のコメント

Brian
Brian 2017 年 10 月 24 日
I see this, but it causes me to go back in and select the file again. I am looking for an efficient way to grab the filename when the file is read and the variables created along with the data parsed into the variables. If I have to use a different method to do all of this, I will.
KL
KL 2017 年 10 月 24 日
the argument you pass to tdfread is the file's name. If you don't have it, how do you execute that command in the first place?
Brian
Brian 2017 年 10 月 24 日
simply having 'tdfread;' as a line in my program opens a dialog box to select a file. From this the top row of the file is read as variables and the successive rows are parsed into columns of data for each variable. I would like to pick of the filename when selected in the open dialog box. In LabView, the fileopen command has the path & filename as outputs of a dialog box. I just can't find anything in the Matlab help.
per isakson
per isakson 2017 年 10 月 24 日
編集済み: per isakson 2017 年 10 月 24 日
It seems you have to do something like
filename = uigetfile
tdfread ( filename )
if you want to use tfdread
KL
KL 2017 年 10 月 24 日
Exactly

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

Brian
Brian 2017 年 10 月 24 日

0 投票

Thanks! This was it.

カテゴリ

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

質問済み:

2017 年 10 月 24 日

コメント済み:

KL
2017 年 10 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by