Importing excel numerical data into menu options

조회 수: 7 (최근 30일)
Julie
Julie 2011년 4월 28일
[EDIT: Thu May 12 23:00:29 UTC 2011 Duplicate Removed - MKF]
This is the code that i have for my program. I am trying to import all of the numerical data from the first column of the worksheet into the menu as options, but it is only giving me the very first one. Please help me figure out what I need to do. Thanks!
%The Excel worksheet 'COST' is inputed into MATLAB.
[COSTdata,COSTtext]=xlsread('48FF5.xlsx','COST');
%The user is prompted to select the diameter of pipe they wish to use.
Diameter=menu('Select pipe diameter',COSTdata(1:length(COSTdata)));

채택된 답변

Walter Roberson
Walter Roberson 2011년 4월 28일
t = cellstr(num2str(costdata(:,1)));
Diameter = menu('Select pipe diameter', t{:});

추가 답변 (1개)

bym
bym 2011년 4월 28일
read the documentation, the second (third, fourth, etc) argument to menu needs to be a string variable
  댓글 수: 1
Julie
Julie 2011년 4월 28일
so how do i make them all string variables?

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

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by