Why am I getting "Undefined operator '*' for input arguments of type 'cell'." when I run this code?

1 view (last 30 days)
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.

Accepted Answer

Sean de Wolski
Sean de Wolski on 5 Aug 2015
You use a { which creates a cell array (container). You probably want to use a [ or ( instead.
  5 Comments
Zakia wani
Zakia wani on 23 Nov 2016
Edited: Zakia wani on 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
Walter Roberson on 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.

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!