필터 지우기
필터 지우기

Why do I get this error: Improper index matrix reference.

조회 수: 2 (최근 30일)
Mohammad
Mohammad 2014년 1월 15일
댓글: Mohammad 2014년 1월 15일
here is my code. I don't understand why I get this error! I want to get some files( or folders) from user, do some changes to each of them, and then save it with the same name but in .png format. the problem is with the line 4 it says (name=figfiles(i),name).
function modifier
figfiles=uigetfile('*.fig','multiselect','on');
a=input('please enter [width(x),aspect ratio(x/y),resolution]');
for i=1:length(figfiles)
name=figfiles(i).name;
h=hgload(name);
set(gcf,'paperunits','centimeters');
set(gcf,'paperposition',[.25 .25 a(1) a(1)*(1/a(2))]);
set(gca,'fontsize',11);
set(findall(gcf,'type','text'),'fontsize',11);
new_name=strrep(name,'.fig','.png');
saveas(h,new_name);
end
end

답변 (1개)

Walter Roberson
Walter Roberson 2014년 1월 15일
uigetfile() with multiselect on returns a cell array of strings, not a structure.
uigetfile() never does an implicit dir() operation: it just returns names of files.
  댓글 수: 1
Mohammad
Mohammad 2014년 1월 15일
thank you, then how can the user enter more than 1 file or a folder? these files should be read and after some changes, they should again be saved in .png format.

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

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by