Why am I getting "Undefined operator '*' for input arguments of type 'cell'." when I run this code?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
imarquez
il 5 Ago 2015
Commentato: Walter Roberson
il 23 Nov 2016
Why would multiplication need to be defined in the last equation in my code but not in the ones above it?
if true
format long
a = 1
b = 3*10^-7
c = 5*10^-8
f0 = 4*10^9
sigma = 0.2
t0 = 0
tmax = 2*b
t = 6*10^-9
omega = 2*pi*f
omega0 = 2*pi*f0
yt = a*exp((-(t-b)^2)/((2*c)^2));
Ff = sqrt(pi/2)*a*c*exp(-7.8957e+05 - 7.5398e+03i)*[erfi(4.2426)-erfi(-4.2426)]
Zf = (sqrt(-1)*sqrt(pi/2)*((a*c*sigma)/4)*exp(-((2*pi*f+omega0)*(c^2*(2*pi*f+omega0)+2*sqrt(-1)*b))))*{-exp(4*pi*c^2*f*omega0+2*sqrt(-1)*b*omega0)*[erfi(((tmax-b+sqrt(-1)*c^2)*(2*pi*f-omega0))/(sqrt(2)*c))-erfi(((t0-b+sqrt(-1)*c^2)*(2*pi*f-omega0))/(sqrt(2)*c))]+[erfi(((tmax-b+sqrt(-1)*c^2)*(2*pi*f+omega0))/(sqrt(-1)*c))-erfi(((t0-b+sqrt(-1)*c^2)*(2*pi*f+omega0))/(sqrt(-1)*c))]}
% code
end
This is the code I'm trying to run and it is able to solve all the way up to Ff. I'm confused.
0 Commenti
Risposta accettata
Sean de Wolski
il 5 Ago 2015
You use a { which creates a cell array (container). You probably want to use a [ or ( instead.
5 Commenti
Zakia wani
il 23 Nov 2016
Modificato: Zakia wani
il 23 Nov 2016
i am getting same error.. Undefined operator '*' for input arguments of type 'cell'. for this code
f= open ('c1.fig');
sp1data = findobj(subplot(4,3,1), 'Type', 'line');
y1 = get (sp1data,'Ydata');
T1 = (-0.3164*y1+161.84);
i tried to use .* instead of only * it still shows same error.. how to multiply then
Walter Roberson
il 23 Nov 2016
Your findobj is finding multiple objects. When you have multiple objects in a get then the output is returned in a cell array. Cell arrays cannot be multiplied but you could use cellfun to multiply the entries producing a cell array of results.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!