Cannot read '*.tif ' file error message despite file being analyzed
Show older comments
I created a MATLAB code that analyzes and applies functions to multiple *.tif files in a for loop. Although the loop is executed for the desired number of iterations and a resulting figure that shows the product is displayed, the following error message is also displayed after the final iteration:
Error using imread (line 438)
TIFF library error - 'TIFFFetchDirectory: Can not read TIFF directory count.'
This is problamatic because the product of this function must be used in anothe code. Even though I acquire the product from the function, I cannot proceed using it in the parent code because of the error message.
I would appreciate your help on how to solve this issue without the error message. Thank you!
4 Comments
Walter Roberson
on 26 Feb 2021
Can you imread the last file by itself? It sounds as if you have a corrupt file.
kameshwar saini
on 26 Feb 2021
clc; clear variables; close all;
N = 10^5;
d1 = 0:10:100; d2 = 500; %Distances of users from base station (BS)
a1 = 0.75; a2 = 0.25; %Power allocation factors
eta = 4; %Path loss exponent
for d1=0:10:100
%Generate rayleigh fading coefficient for both users
h1 = sqrt(d1^-eta)*(randn(1,N)+1i*randn(1,N))/sqrt(2);
h2 = sqrt(d2^-eta)*(randn(1,N)+1i*randn(1,N))/sqrt(2);
end
g1 = (abs(h1)).^2;
g2 = (abs(h2)).^2;
Pt = 0:2:40; %Transmit power in dBm
pt = (10^-3)*10.^(Pt/10); %Transmit power in linear scale
BW = 10^6; %System bandwidth
No = -174 + 10*log10(BW); %Noise power (dBm)
no = (10^-3)*10.^(No/10); %Noise power (linear scale)
p = length(Pt);
p1 = zeros(1,length(Pt));
p2 = zeros(1,length(Pt));
d = length(d1);
rate1 = 1; rate2 = 2; %Target rate of users in bps/Hz
for u = 1:p
%Calculate SNRs
gamma_1 = a1*pt(u)*g1./(a2*pt(u)*g1+no);
gamma_12 = a1*pt(u)*g2./(a2*pt(u)*g2+no);
gamma_2 = a2*pt(u)*g2/no;
%Calculate achievable rates
R1 = log2(1+gamma_1);
R12 = log2(1+gamma_12);
R2 = log2(1+gamma_2);
%Find average of achievable rates
R1_av(u) = mean(R1);
R12_av(u) = mean(R12);
R2_av(u) = mean(R2);
%Check for outage
for k = 1:N
if R1(k) < rate1
p1(u) = p1(u)+1;
end
if (R12(k) < rate1)||(R2(k) < rate2)
p2(u) = p2(u)+1;
end
end
end
figure;
plot(d1, R1_av, 'linewidth', 1.5); hold on; grid on;
I want to plot the graph between d1 and R1_av but I am getting blank plot . Please help me
Walter Roberson
on 2 Mar 2021
@kameshwar saini You asked this at https://www.mathworks.com/matlabcentral/answers/756649-i-want-to-plot-the-graph-between-d1-and-r1_av-but-i-am-getting-blank-plot-please-help-me?s_tid=srchtitle and were given an answer there.
Lina Koronfel
on 30 Mar 2021
Answers (0)
Categories
Find more on Bartlett in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!