Export excel file into matlab and make graph
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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 件のコメント
Yogesh Babu
2014 年 2 月 27 日
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
Yogesh Babu
2014 年 2 月 28 日
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 件のコメント
Yogesh Babu
2014 年 2 月 27 日
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
Dishant Arora
2014 年 2 月 27 日
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');
Yogesh Babu
2014 年 2 月 27 日
Is it possible to make it loop and do this for more Excel files?
Dishant Arora
2014 年 2 月 27 日
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.
Yogesh Babu
2014 年 2 月 27 日
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);
Dishant Arora
2014 年 2 月 27 日
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 .
Yogesh Babu
2014 年 2 月 28 日
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')
Yogesh Babu
2014 年 3 月 10 日
Hello, I tried using the solutions which is working for one image when try to execute in loop it is not working
Dishant Arora
2014 年 3 月 10 日
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
Yogesh Babu
2014 年 3 月 10 日
hello, when i run this code i get the following Error
Error in elsgm (line 14) h = plot(Array(:,1) , Array(:,2)); % plot.
Dishant Arora
2014 年 3 月 10 日
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
Yogesh Babu
2014 年 3 月 10 日
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
Yogesh Babu
2014 年 3 月 10 日
Hello, Thank you very much it really works!!
Yogesh Babu
2014 年 3 月 10 日
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 );
Dishant Arora
2014 年 3 月 11 日
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.
Yogesh Babu
2014 年 3 月 11 日
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
Dishant Arora
2014 年 3 月 11 日
figureFile = strcat(regexprep(baseFileName , '.xls' , '') , '.jpg')
saveas(h , figureFile );
% where baseFileName has already been evaluated in the loop earlier
Yogesh Babu
2014 年 3 月 11 日
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
Yogesh Babu
2014 年 3 月 11 日
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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
