From: th on
hallo there.
i have an excel file with 4 rows and 30 columns. At first i load my excel file.Next i want to put a dialog box in my programm , so if the programmer chooses 1 the programm should read the first line of the excel file,if the programmer chooses 2 the programm should read the second line etc... I

any ideas how can i do it??

I ve tried this code but it doesnt work.it doesnt read the lines i want,and it doesnt print the line i want in the workspace:

choise=xlsread('zernik.xls');
choice = inputdlg('1: Preset coeffs 2:choise','Choose 1 2 3 4');
choice = str2num(choice{1});

if (choise==1)
Z1=choice(1:end,1);

elseif (choice ==2)
Z2=choice(2:end,1);


end

end

any ideas please???
From: ImageAnalyst on
The badly-named "choise" is a cell array that is the contents of your
workbook. It will never equal 1 since it's a cell array, so that if
statement is totally bogus. Next, you're setting Z1 equal to the
user's response, but the user's response ("choice") is a 1D character
string, not a 2D array. Then the second if statement, which for some
bizarre reason is sort of almost correct unlike your first if
statement, has the same problem.

Why don't you say:
caMyWorkBook = xlsread('zernik.xls');
%caMyWorkBook = { '11', '12'; '21', '22'} % Test code.
userPrompt = sprintf('Enter the row number\nChoose 1, 2, 3, or 4');
choice = inputdlg(userPrompt)
if strcmpi(choice, '1')
theRow = caMyWorkBook(1, :)
else
theRow = caMyWorkBook(2, :)
end

From: th on
ohhh!!!!thank you soooooooooo much!!!you cant imagine how many days im trying to solve this!!!

thank you thank you thank you!!!!






ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <82a498f2-c190-4d2d-bf60-cc917c8b0c13(a)v37g2000vbv.googlegroups.com>...
> The badly-named "choise" is a cell array that is the contents of your
> workbook. It will never equal 1 since it's a cell array, so that if
> statement is totally bogus. Next, you're setting Z1 equal to the
> user's response, but the user's response ("choice") is a 1D character
> string, not a 2D array. Then the second if statement, which for some
> bizarre reason is sort of almost correct unlike your first if
> statement, has the same problem.
>
> Why don't you say:
> caMyWorkBook = xlsread('zernik.xls');
> %caMyWorkBook = { '11', '12'; '21', '22'} % Test code.
> userPrompt = sprintf('Enter the row number\nChoose 1, 2, 3, or 4');
> choice = inputdlg(userPrompt)
> if strcmpi(choice, '1')
> theRow = caMyWorkBook(1, :)
> else
> theRow = caMyWorkBook(2, :)
> end