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 Comment

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().

Sign in to comment.

Answers (1)

[filename, pathstring] = uigetfile(dirname);
fname = fullfile(pathstring, filename);
data = xlsread(fname);

Categories

Find more on Scope Variables and Generate Names in Help Center and File Exchange

Asked:

on 13 Oct 2015

Answered:

on 13 Oct 2015

Community Treasure Hunt

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

Start Hunting!