change extension from .mat to .csv or .xls

i have a matlab code but i want to test it with my own data. and the problem i couldn't find a way to insert my own data ...can anyone please help me to change those code lines into a way that i could insert my csv or xls data
here the exemple :
% Get input data
fname=strcat(dirname,'data',num2str(file),'.mat');
fname1=strcat(fdirname,'forecast',num2str(file),'.mat');
load(fname);
data=dataout;

1 commentaire

TastyPastry
TastyPastry le 13 Oct 2015
Why do you need to change the file extension if you're using your own input .csv or .xlsx? You should be able to import your own data using csvread(), xlsread() or fopen() with textscan().

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 13 Oct 2015
[filename, pathstring] = uigetfile(dirname);
fname = fullfile(pathstring, filename);
data = xlsread(fname);

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by