Got Questions? Get Answers.
Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Passing of content from stored row and column subscripts

Subject: Passing of content from stored row and column subscripts

From: Lin

Date: 8 Feb, 2009 09:41:02

Message: 1 of 1

Hello.

i had actually posted this problem days ago, but i did not receive a response. I hope that someone can help me in this. Thanks. I got most of the program right except the looping portion.
i am storing the equivalent row and column subscripts when the items in a column equals to 2. The unique function helps to identify I need to use the content from column 2 as well as column 3.

expected result:
for-loop
%use the content from I(1),J(2) and I(2),J(2) & sub into the following cArray equation
cArray{in} = row1(i)*a{I(1),J(2)} + row2(i)*a{I(2),J(2)};
 in = in+1;
end;

%use the content from I(1),J(3) and I(3),J(3) and go through for-loop again.
%this time, page 2 of cArray will be used to store the Equ result.

%Program that i have done so far
a = {[1;1] [1;0] [3;2]
        [] [0;1] [4;5] }
idx =sum(~cellfun(@isempty,a))<=1;
a(:,idx)={[]};
[I,J]=ind2sub(size(a),find(~cellfun(@isempty,a)));
disp([I J])
idx2 = unique(J);
ix = dec2bin(0:3)'-'0' ;
 row1 = ix(1,:);
 row2 = ix(2,:);
  in= 1;
  for i = 1:4
     cArray{in} = row1(i)*a{I(1),J(2)} + row2(i)*a{I(2),J(2)};
     in = in+1;
 end;

View thread: http://www.mathworks.com/matlabcentral/newsreader/view_thread/243957

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us