I have to access 2 excel files and generate image & do some image processing over that
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Guillaume
le 29 Jan 2015
- 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.
- Maybe it's because of the formatting, but I can't see a question.
Réponse acceptée
Guillaume
le 29 Jan 2015
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?
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!