Effacer les filtres
Effacer les filtres

error "The expression to the left of the equals sign is not a valid target for an assignment."

59 vues (au cours des 30 derniers jours)
I run a test program shown below:
clear all;
clc;
image_a = imread('doll_full_color','png');
histo = histogram(image_a);
error comes:
??? Error: File: histogram.m Line: 12 Column: 30
The expression to the left of the equals sign is not a valid target for an assignment.
Error in ==> test_his at 5
histo = histogram(image_a);
For your information, histogram is a function I defined to calcuate the histogram of an image,shown below:
function [ histo ] = histogram( image )
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
clc;
[row, column] = size(image,3);
histo = zeros(256,3);
histo_sum = zeros(256,3);
for m=1:1:3
for i=0:1:255
for j=1:1:row
for k=1:1:column
if( image(j,k,m) = i)
histo_sum(i,m) = histo_sum(i,m) +1;
end
end
end
end
end
histo = histo_sum/(row*column);
end
Anyone can help solve the problem? Thank you!

Réponse acceptée

Walter Roberson
Walter Roberson le 18 Avr 2012
The comparison operator is ==
if( image(j,k,m) == i)

Plus de réponses (4)

supriya
supriya le 18 Avr 2012
I m not sure but try this...
image_a = imread('doll_full_color.png'); histo = histogram(image_a);

zhang
zhang le 19 Avr 2013
but how to solve the problem blew:
clear all
t0=0;
dt=0.05;
t1=1;
tf=5;
t=[t0:dt:tf];
st=length(t);
n1=floor((t1-t0)/dt) x1=zeros(1,st); x(n1)=1/dt; subplot(2,2,1),stairs(t,x1),grid on
x2=[zeros(1,n1-1),ones(1,st-n1+1); subplot(2,2,3); stairs(t,x2); grid on w=10;; u=-0.5; x3=exp((u+j*w)*t); subplot(2,2,2),plot(t,real(x3)),grid on; subplot(2,2,4),plot(t,imag(x3)),grid on;
hope some can solve my problem!

dorai raj
dorai raj le 11 Mai 2021
The expression to the left of the equals sign is not a valid target for an assignment

dorai raj
dorai raj le 11 Mai 2021
i want h=1.3,where h=c/d:c=(n/m),m=(a/b)
n=1;
m=(1:10);
a=5;
b=(0.3:6);
while h>(c./d);
c=(n./m);d=(a./b);
h=1.3;
  3 commentaires
dorai raj
dorai raj le 12 Mai 2021
where h=c/d,
c=(n/m),m=(a/b)
n=2
m=0.1 to 8
a=1
b=0.4 to 9
how to get h=1.3?
Walter Roberson
Walter Roberson le 12 Mai 2021
c = n/m, m = a/b implies that c = n/(a/b) --> c = n*b/a
n and a are known values 2 and 1, so c = 2*b/1 --> c = 2*b
m is a/b where a = 1, so m = 1/b and m is restricted to 0.1 to 8 so that implies that b is restricted to the range 1/8 to 10 . But b = 0.4 to 9 which is a tighter restriction on both sides. The actual range of m is therefore 1/9 to 5/2
c = n/m and n = 2 and m is 1/9 to 5/2 so c = 2/(1/9 to 5/2) so c is in the range 2/9 to 5
h = c/d so h = (2/9 to 5) / d = 1.3 . So d = (2/9 to 5)/(13/10) which is 20/(9*13) to 50/3 which is about 0.171 to 16 2/3 .
There is not unique solution.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by