필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Question regarding index and loop

조회 수: 1 (최근 30일)
William
William 2013년 5월 6일
마감: MATLAB Answer Bot 2021년 8월 20일
%get the directory and the file of the data
[filename, pathname]=uigetfile('MultiSelect','on','*.dat')
%combine the pathname and the filename
for index=[1:length(filename)]
f = fullfile(pathname,filename{index})
end
I have written a code above so that I could attain the pathname and filename
of a dat file. I connected the pathname and the filename using the fullfile function.
Because there are multiple files, I would like to make a loops so that each filename+ pathname would have a different set of variables.
Thank you.
  댓글 수: 1
William
William 2013년 5월 6일
편집: William 2013년 5월 6일
%get the directory and the file of the data
[filename, pathname]=uigetfile('MultiSelect','on','*.dat')
%combine the pathname and the filename
for i=[1:length(filename)]
f(i) = fullfile(pathname,filename{i})
end
%load the datas using load(), the step must be in a loop such
that each
%sets of data would have an index that corresponds to the
filename index
I tried something like this but says
??? In an assignment A(:) = B, the number of elements in A and B
must be the same.
Error in ==> ini at 5
f(i) = fullfile(pathname,filename{i})

답변 (1개)

Jan
Jan 2013년 5월 6일

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by