필터 지우기
필터 지우기

I have to access 2 excel files and generate image & do some image processing over that

조회 수: 1 (최근 30일)
clc clear Amp=xlsread('C:\Users\AMIT\Desktop\CB\excel\3\3-1 amp data.xls'); Th=xlsread('C:\Users\AMIT\Desktop\CB\excel\3\3-1 thick data.xls'); X=Amp(515:514:131584); Y=Amp(2:1:514); Z=Amp(2:1:514,2:1:256); T=Th(2:1:514,2:1:256); axes('FontSize',20); image(Y,X,Z');figure axes('FontSize',20); imagesc(Y,X,T');figure
for i=1:1:513 for j=1:1:255 if ((Z(i,j)>=80) && (Z(i,j)<=90)) A(i,j)=Z(i,j); B(i,j)=T(i,j); else A(i,j)=0; B(i,j)=0; end end end axes('FontSize',20); image(Y,X,A');figure axes('FontSize',20); imagesc(Y,X,B');figure axes('FontSize',20);
for i=1:1:513 for j=1:1:255 if B(i,j)>=8.0 && B(i,j)<=9.999 A4(i,j)=B(i,j); else A4(i,j)=0; end end end axes('FontSize',20); imagesc(Y,X,A4');figure
% Amp (amplitude) is reading an excel file having data varying from 0-100 % Th(thick) is reading excel file with data ranging ffrom 0- 30 % now i have to check for a certain thickness range various amplitude levels , these data belong to a common trial % such as for a thickness range of 8.5-9 mm I have to generate image of amplitude levels 50-60,60-70 and so on
  댓글 수: 3
Guillaume
Guillaume 2015년 1월 29일
  1. At present, your post is near unreadable. Use the {} Code formatting button to format your code. Your goal is to make it as easy as possible for people to help you, otherwise you'll get no help.
  2. Maybe it's because of the formatting, but I can't see a question.
AMIT VERMA
AMIT VERMA 2015년 1월 29일
clc
clear
Amp=xlsread('C:\Users\AMIT\Desktop\CB\excel\3\3-1 amp data.xls'); Th=xlsread('C:\Users\AMIT\Desktop\CB\excel\3\3-1 thick data.xls'); X=Amp(515:514:131584);
Y=Amp(2:1:514);
Z=Amp(2:1:514,2:1:256);
T=Th(2:1:514,2:1:256);
axes('FontSize',20);
image(Y,X,Z');
figure axes('FontSize',20);
imagesc(Y,X,T');figure
for i=1:1:513
for j=1:1:255
if ((Z(i,j)>=80) && (Z(i,j)<=90))
A(i,j)=Z(i,j);
B(i,j)=T(i,j);
else A(i,j)=0;
B(i,j)=0;
end
end
end
axes('FontSize',20);
image(Y,X,A');
figure axes('FontSize',20);
imagesc(Y,X,B');
figure axes('FontSize',20);
for i=1:1:513
for j=1:1:255
if B(i,j)>=8.0 && B(i,j)<=9.999
A4(i,j)=B(i,j);
else A4(i,j)=0;
end
end
end
axes('FontSize',20);
imagesc(Y,X,A4');figure
% Amp (amplitude) is reading an excel file having data varying from 0-100 % Th(thick) is reading excel file with data ranging ffrom 0- 30 % now i have to check for a certain thickness range various amplitude levels , these data belong to a common trial % such as for a thickness range of 8.5-9 mm I have to generate image of amplitude levels 50-60,60-70 and so on

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

채택된 답변

Guillaume
Guillaume 2015년 1월 29일
Ok, now that your code is readable, I can see that you
  • load two excel files
  • plot the data of these excel files, which consists of a row of x coordinates, a column of y coordinates and data at the intersection. Confusingly, you're switching between linear and subscript indices. Consistency in programming is always good. I would stick to subscript indices:
X = Amp(1, 2:256); %and if 256 is the last column, X = Amp(1, 2:end)
Y = Amp(2:514, 1); %again if 514 is the last row, Y = Amp(2:end, 1)
Z = Amp(2:514, 2:256); %or Amp(2:end, 2:end)
T = Th(2:514, 2:256);
%...
  • You then have an unnecessary for loop to extract part of the data and plot that. The loop could be replaced by:
A = zeros(size(Z));
B = zeros(size(Z));
inrange = (Z >= 80 & Z <= 90); %should both edges be included?
A(inrange) = Z(inrange);
B(inrange) = T(inrange);
A = A(1:end-1, 1:end-1); %for some reason you don't want the last row/column
B = B(1:end-1, 1:end-1);
  • Then, another loop and plot. The loop could be replaced by
A4 = zeros(size(B))
inrange = (B >= 8 & B < 10);
A4(inrange) = B(inrange);
  • But what is your question?

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by