필터 지우기
필터 지우기

Load a file by using a string in which the filename is stored

조회 수: 13 (최근 30일)
Rudy
Rudy 2013년 3월 1일
댓글: ANKUR KUMAR 2017년 10월 8일
I use these commands to create string with all names of the files that have a mat extension.
files = dir('*mat'); filenames = {files.name};
Now I want to load one of these files by just using a number
load(filenames(1)) or load filenames(1) or load('filenames(1)')
But none of these commands work. Any ideas?

채택된 답변

Açmae
Açmae 2013년 3월 1일
편집: Açmae 2013년 3월 1일
Hi Rudy -
'filename(1)' is a 1x1 cell in your case. In order to access the content of the cell, you would use curly brackets.
>> load(filename{1})
Cheers, Açmae

추가 답변 (1개)

Rudy
Rudy 2013년 3월 3일
Thanks, that fixed it!!

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by