フィルターのクリア

calling a function?

1 回表示 (過去 30 日間)
Forza
Forza 2020 年 12 月 1 日
コメント済み: Rik 2020 年 12 月 4 日
Apologies for my bad english,
I have a function that is supposed to return certain properties from a table when I insert a script. I do not think I am explaining it correctly, but this is the best way I can explain it. When I insert a store name, it is supposed to output a different number of apples, bananas, and oranges(i.e apples = 2, bananas = 3 , oranges = 1)
I apologize again as I am using translate but this is the best way I can describe it. Please tell me where I went wrong and thank you :)
function [apples, bananas, oranges]= Store_Name(A)
end
  3 件のコメント
Walter Roberson
Walter Roberson 2020 年 12 月 2 日
Caution: user will delete question after they receive an answer.
Rik
Rik 2020 年 12 月 4 日

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

回答 (1 件)

Shubham Khatri
Shubham Khatri 2020 年 12 月 4 日
Hello,
To my understanding of the question I have made a code. Please take a look.
clc
clear
global T;
T=readtable('mlq.xlsx'); %reading the table
s=input('Please type input ','s') %asking user to input the store name
[apple, oranges, banans]=store_details(s)
function [apples oranges bananas]=store_details(s)
global T;
n=find(strcmp(T.Store,s)==1);
apples=T(n,2); %returning values in corresponding variable
oranges=T(n,4);
bananas=T(n,3);
end
Hope it helps

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by