Trying to get certain values from an excel file as user input

4 ビュー (過去 30 日間)
Dominik
Dominik 2022 年 12 月 3 日
コメント済み: Dominik 2022 年 12 月 4 日
Hi,
I need to make a code that would ask user to choose range of days (Datum), and than choose another value (from B to H) and make graph out of these values. Also the are lot of empty brackets so im not sure if it would be better to use xlsread or readtable.
Any help would be appreciated.

採用された回答

Image Analyst
Image Analyst 2022 年 12 月 3 日
You should probably use readtable or readmatrix since xlsread is deprecated.
You should probably plot one or more curves first, before asking the user, so they know what values of Datum to specify.
To ask a user for two floating point numbers, see this snippet:
% Ask user for two floating point numbers.
defaultValue = {'6.3.2020', '18.3.2020'};
titleBar = 'Enter values';
userPrompt = {'Enter date 1 : ', 'Enter date 2: '};
caUserInput = inputdlg(userPrompt, titleBar, 1, defaultValue);
if isempty(caUserInput),return,end % Bail out if they clicked Cancel.
% Convert to floating point from string.
usersValue1 = str2double(caUserInput{1})
usersValue2 = str2double(caUserInput{2})
You might want to convert the dates to numbers to get the row index of those dates. They've been changing the date manipulation functions so much over the past few years, it's hard to keep track of the best, recommended functions to use to do that so you'll have to do a little research on that.
  1 件のコメント
Dominik
Dominik 2022 年 12 月 4 日
Thank you very much, this helps a lot since i wasn't really sure how to do it.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by