MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Roza on 4 Jan 2013

I want to compare two string data. but when I use the expression for and if, it can not be run.

i'm sorry... this is my code... I am a beginner, please your help.

clear; clc; [data2,follower]=xlsread('follower.xlsx'); [data3,mention]=xlsread('mentions.xlsx'); [data5,wg]=xlsread('wg.xlsx'); n_vertex=length(follower(:,1)); wg=0;; for i=1:n_vertex for j=1:n_vertex if isequal(follower{i,1}==mention{i,1}, follower{i,2}==mention{i,2}) if follower{i,1}==wg{i,1} wg=wg+data5(i,1)+1; end; end; end end

============================================================================== Error using ==> eq Matrix dimensions must agree.

Error in ==> oo at 17 if isequal(follower{i,1}==mention{i,1}, follower{i,2}==mention{i,2})

================================================================================ I want to make it again from (1) to n_vertex. but it seems there is something wrong .. please help, thank you.

*No products are associated with this question.*

Answer by Walter Roberson on 4 Jan 2013

Accepted answer

if strcmp(YourCellArray{SomeIndex}, YourCellArray{SomeOtherIndex})

## 3 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/57975#comment_120700

Post your code

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/57975#comment_120701

It is impossible to guess what you have written as code and what "it cannot run" exactly means. Please post the code, example data and explain, what's going wrong. E.g. a copy of the error message would be helpful, if there is one.

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/57975#comment_120888

tanks for coming.. I have input code. please help.:) tanks before :)