필터 지우기
필터 지우기

Check and read different types of file types.

조회 수: 25 (최근 30일)
Vasiliki Thomopoulou
Vasiliki Thomopoulou 2020년 11월 26일
댓글: Vasiliki Thomopoulou 2020년 11월 26일
Hey there. I want to make a program that will ask the user to import a file, and then the program will check if the file is .csv, if not it will check if it is .ods, if not it will check if it is .xls and will read it in all of these cases. If not it will print an error message and ask the user to import the file again. Do you have any idea? Even the slightest help would be great. Thank you vary much.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 26일
I am not sure about .ods, but MATLAB's readmatrix() is capable of importing .csv and .xls file. You don't need to tell MATLAB the type of file. It will automatically detect it based on the file extension.
You can use uigetfile() function to graphically prompt the user to select a file.
  댓글 수: 1
Vasiliki Thomopoulou
Vasiliki Thomopoulou 2020년 11월 26일
Thanks a lot for your response Ameer, I will try it.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by