Using Excel files in function
이전 댓글 표시
I have a spreadsheet of list of cities and distances between them such as
New York Washington DC Los Angeles
New York 0 500 . 1000
Washington DC 500 0 . 1500
Los Angeles 1000 1500 0
how do i create a function which takes 2 cities as input and gives the distance as output, given that invalid city names give 0 as distance?
I tried a few things but honestly I don't know how to proceed with this problem.
댓글 수: 2
Bob Thompson
2019년 2월 7일
Could you expand a little on what things you tried, and why they didn't work? That will help us give you a more clear answer, rather than something super general.
채택된 답변
추가 답변 (1개)
Ana Guerreiro
2019년 4월 27일
0 개 추천
Hi Bob Nbob
Your code does not work for "non-existent city" that needs to be equal to -1 (Distance= -1).
Can you help me, showing how to do it, please?
Best regards
카테고리
도움말 센터 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!