Export excel file into matlab and make graph
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hello, I have 50+ Excel files in that i need to import in Matlab and convert into Graph.Do any one have idea how to do that automatically
댓글 수: 2
Thanks for your reply
Is that possible to use some parameter from the file for example 2 parameters and plot them and save them in matlab as picture that is .fig file.
Like that it is possible for 50+ files
Hi, plot(Resultsforyyyy);figure(gcf); saveas(gcf,'Peile.fig') In the above line my pelie.fig is fixed one i want to use that with respect to the data i am plotting.Is that possible?
채택된 답변
Dishant Arora
2014년 2월 27일
댓글 수: 20
Thanks for your reply
Is that possible to use some parameter from the file for example 2 parameters and plot them and save them in matlab as picture that is .fig file.
Like that it is possible for 50+ files
Better go throgh the documentation of xlsread to see the variations it provides. And to save a matlab figure as picture:
h = plot(yourData(:,1),yourData(:));
saveas(h,'fileName','jpg');
Is it possible to make it loop and do this for more Excel files?
The link I gave you does exactly the same. You just need to make slight changes given you need to read excel sheets instead of image.
when i Run the code which you said to read i am getting the following Error. I am New to Matlab help me in sorting out this error
Error in qa (line 5) matData = load(matFilename);
That's just a prototype. Try to understand the code and make appropriate changes. I am sure you can do that on your own. And you should use xlsread instead of load .
Hello, saveas(h,'fileName','jpg'); In this once file name must be saved with respective to the image analyzed corresponding figure has to be generated.Is that possible?
Dishant Arora
2014년 2월 28일
편집: Dishant Arora
2014년 3월 10일
generate the name using strcat inside the loop.
fileName = strcat('figure',num2str(ii));
saveas(h,fileName ,'jpg')
Hello, I tried using the solutions which is working for one image when try to execute in loop it is not working
myFolder = 'C:\Documents and Settings\yourUserName\My Documents';
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
uiwait(warndlg(errorMessage));
return;
end
filePattern = fullfile(myFolder, '*.xls');
xlsFiles = dir(filePattern);
for k = 1:length(xlsFiles)
baseFileName = xlsFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
Array = xlsread(fullFileName);
h = plot(Array(;,1) , Array(:,2)); % plot.
drawnow; % Force display to update immediately.
figureFile = strcat('figure' , num2str(k) , '.jpg')
saveas(h , figureFile );
end
hello, when i run this code i get the following Error
Error in elsgm (line 14) h = plot(Array(:,1) , Array(:,2)); % plot.
That you have to figure out how data is arranged in the sheet.
Array = xlsread(fullFileName);
h = plot(Array); % Plots all the columns individually against the indices
Hello, I am interested in plotting two Parameters so i have added the following codes in the codes which you gave me.but i am getting the error.I have also attached the excel file which i need to generate Blob and Area in plot
Undefined variable "raw" or class "raw". | Error in Untitled4 (line 14) data = reshape([raw{:}],size(raw)); |
Array = xlsread(fullFileName,'Results','B3:C124'); data = reshape([raw{:}],size(raw)); Blob = data(:,1); Area = data(:,2); clearvars data raw; h=plot(Blob,Area);figure(gcf);% Plots all the columns individually against the indices drawnow; % Force display to update immediately. figureFile = strcat('figure' , num2str(k) , '.jpg') saveas(h , figureFile ); end
Hello, Thank you very much it really works!!
Hello, The solution which works fine.But Is that possible to save the image in the form which is being imported.but here it stored in the form of 'Figure'
figureFile = strcat('figure' , num2str(k) , '.jpg')
saveas(h , figureFile );
what do you mean by save the image in the form which is being imported?? what you did was import data from xls sheet and plot it.
Hello, Actually i am interested in saving the image file in the name which is being imported for example the excel file 1.sample1.xlsx 2.sample2.xlsx 3.sample3.xlsx if the excel file is in this format then plotted graph should be the same 1.sample1.jpg 2.sample2.jpg 3.sample3.jpg
figureFile = strcat(regexprep(baseFileName , '.xls' , '') , '.jpg')
saveas(h , figureFile );
% where baseFileName has already been evaluated in the loop earlier
Hello, Thank you very much it works.. I have attached a excel file in that there are 2 parameters in that first parameter is Number and second parameter is Area.In that Largest number of area must subtracted with rest of the whole area in the Excel.Is that possible
Hello, I have attached the file
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
