Where is the problem???

Hi,
UserData.matrix(3,3) is type of cell, and d is also type of cell. I got this error:
??? Error using ==> mupadmex Error in MuPAD command: Can't evaluate to boolean [bool];
during evaluation of 'subproc'
Error in ==> sym.sym>sym.eq at 755 X = mupadmex('symobj::eq',A.s,B.s,9);
Error in ==> Simulator>vzaj_indukc_Callback at 5432 find(sym(UserData.matrix(3,3))==sym(d))
Why? Here is the code:
find(sym(UserData.matrix(3,3))==sym(d))

6 Comments

At the command prompt give the command
dbstop if error
and run the program. When it stops, use the command
dbup
as many times as you need to in order to get back to vzaj_indukc_Callback. Once you are there, please show us what UserData.matrix(3,3) and d contain.
I suspect the error has to do with the cell nature. I am not sure what sym() of a cell array would mean.
Hi, for example UserData.matrix(3,3) is "L1,ww,3||L2,M2,2||L3,f44,2.4" and d is "L1".
So for example find('L1,ww,3||L2,M2,2||L3,f44,2.4'=='L1')
I thing, "sym" is problem....if I use "char"
find(char(UserData.matrix{3,3})==char(d))
then is error ??? Error using ==> eq Matrix dimensions must agree.
john
john on 10 Sep 2013
Edited: john on 10 Sep 2013
with "char" and based on dbstop if error and dbup I got:
% evaluate the callback now
varargin{1} = gui_State.gui_Callback;
if nargout
[varargout{1:nargout}] = feval(varargin{:});
else
here***** feval(varargin{:});
end
I used
strfind(char(UserData.matrix{3,3}),char(d))
Is UserData.matrix(3,3) a cell that contains the symbolic expression
L1,ww,3||L2,M2,2||L3,f44,2.4
? I am not sure how you would construct such an expression in MuPAD; would it be via
(L1,ww,3)||(L2,M2,2)||(L3,f44,2.4)
thus constructing sequences joined by ? Or is it a vector entry, sort of a Vector((L1,ww,3), (L2,M2,2), (L3,f44,2.4)) with sequences as each of the vector entries? Or is it a 3 x 3 matrix,
L1 ww 3
L2 M2 2
L3 f44 2.4
??
UserData.matrix is not always 3 x 3 matrix, but in column 3 is information. This information means: with witch inductors has inductor a mutual inductance. "L1,ww,3" means than inductor has mutual inductance with inductor L1, ww is mutual inductance and 3 is numerical value of mutual inductance.
To add new info I use:
UserData.matrix{pom3+3,3}=sscanf(strcat(char(UserData.matrix{pom3+3,3}),',,',char(pom2),',',get(handles.mut_ind_symb,'string'),',',get(handles.mut_ind_val, 'String')), '%s');
I hope it is answer :-)

Sign in to comment.

 Accepted Answer

Don't cast to anything! Just use strfind():
string1 = 'L1,ww,3||L2,M2,2||L3,f44,2.4'
d = 'L1'
location = strfind(string1, d)
if ~isempty(location)
message = sprintf('%s was found\nin %s\nat index %d.',...
d, string1, location);
else
message = sprintf('%s was NOT found in %s.',...
d, string1);
end
uiwait(msgbox(message));

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!