Using For Loop To Enter a User Input into an Array

조회 수: 3 (최근 30일)
Michael Doherty
Michael Doherty 2016년 10월 28일
답변: KSSV 2016년 10월 29일
I'm having problems getting a grasp on for loops. I'm trying to create a small data chart of sorts that asks the user for their name, phone number, and age, but I'm having trouble writing the for loop to add to the array.
So right now, it's a single row
Name Phone Number Age
Now I know I need a for loop nested within another for loop, but not sure to go about writing it to come out like:
Name Phone Number Age
John 7144359691 32
Sarah 3862211756 24
etc...etc...
Any suggestions?
  댓글 수: 2
James Tursa
James Tursa 2016년 10월 28일
What do you have so far? Are you using a table?
Michael Doherty
Michael Doherty 2016년 10월 28일
Im reading an .xlsx file using
[~,str] = xlsread('filename.xlsx');
that only contains Name, Phone Number, Age and tried using a for loop to add to those headers, but to no avail.

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2016년 10월 29일
[num,txt,raw] = xlsread(filename);
raw has all the information you are looking for.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by