How to use a user input to open a file and use values within that file?

1 回表示 (過去 30 日間)
Bedanta
Bedanta 2012 年 9 月 21 日
I have a number of files that contain similar information. I am trying to write a program to open each file on user input and do its thing. But I am struggling to code it as a complete newbie;
line=input('Which DASI line do you want to organise?(Type 1 for Line 1) ','s'); navfile=strcat('D',line,'_positions'); load (strcat(navfile,'.txt'))
e.g load D1_positions.txt
I want to be able to do this: T=[D1_positions(:,3),D1_positions(:,2),D1_positions(:,1),D1_positions(:,4),D1_positions(:,5),D1_positions(:,6)];
The value D1_positions need to change depending on the user input.
How do I do this?
  1 件のコメント
per isakson
per isakson 2012 年 9 月 21 日
編集済み: per isakson 2012 年 9 月 21 日
If D1_positions.txt contains at least six columns of of numbers (and no letters) your code should work. What's the problem?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by