Thread Subject: Input by user

Subject: Input by user

From: Corinna Schmitt

Date: 1 Aug, 2007 13:57:34

Message: 1 of 2

Hallo,

I want to modify my program so that the user can say how the inputfile is called. At the moment it is "HARD" programmed like this:

%CAUTION
%The user must check for the next 8 program lines if they are correct
%constants
numberOfRowsPlusHeader = 2049; %Number of rows in the AIDA-output file inclusiv header
numberOfColumns = 12; %Number of columns in the AIDA-output file

%Import file BeispielTabelle_170707.txt
%number and names of varaiables in [] brackets correponds to the header of
%the AIDA-output file (=column names)
%number of %s corresponds to the number of column of the AIDA-output file
[MchipsID, prim_sec, Name, Integral, Bkg, category, Label, Area, Integral_Bkg, Homogeneity, Saturated, Quality] = ...
textread('BeispielTabelle_250707.txt','%s %s %s %s %s %s %s %s %s %s %s %s',numberOfRowsPlusHeader, 'delimiter', '\t');

The goal is that I receive the following information from the user:

1. numberOfRowsPlusHeader = How many rows has the input-file?

2. name of the input-file --> in example: 'BeispielTabelle_250707.txt'

Please help me. I just know from the other programming languages it might be "ask". How does the command looks like here?

Thanks, Corinna

Subject: Input by user

From: Robert Aungst

Date: 1 Aug, 2007 17:33:07

Message: 2 of 2

I believe the command you are looking for is "input". Check it out with "help input".

Cheers,
Robert

"Corinna Schmitt" <csc@mathworks.com> wrote in message <f8q3ge$551$1@fred.mathworks.com>...
> Hallo,
>
> I want to modify my program so that the user can say how the inputfile is called. At the moment it is "HARD" programmed like this:
>
> %CAUTION
> %The user must check for the next 8 program lines if they are correct
> %constants
> numberOfRowsPlusHeader = 2049; %Number of rows in the AIDA-output file inclusiv header
> numberOfColumns = 12; %Number of columns in the AIDA-output file
>
> %Import file BeispielTabelle_170707.txt
> %number and names of varaiables in [] brackets correponds to the header of
> %the AIDA-output file (=column names)
> %number of %s corresponds to the number of column of the AIDA-output file
> [MchipsID, prim_sec, Name, Integral, Bkg, category, Label, Area, Integral_Bkg, Homogeneity, Saturated, Quality] = ...
> textread('BeispielTabelle_250707.txt','%s %s %s %s %s %s %s %s %s %s %s %s',numberOfRowsPlusHeader, 'delimiter', '\t');
>
> The goal is that I receive the following information from the user:
>
> 1. numberOfRowsPlusHeader = How many rows has the input-file?
>
> 2. name of the input-file --> in example: 'BeispielTabelle_250707.txt'
>
> Please help me. I just know from the other programming languages it might be "ask". How does the command looks like here?
>
> Thanks, Corinna

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com