I have 100 rows and 4 columns of data. I want to go row by row, extract data, assign each column for parameters and do calculation and store as output. Similarly, I need to select next rows and so on. From all outputs, I need to select the least value. For that least output, I need to get the row number also.

댓글 수: 6

Stephen23
Stephen23 2016년 8월 2일
@Venkatesh Baskaran: what is your question ?
Venkatesh Baskaran
Venkatesh Baskaran 2016년 8월 2일
I have 10 Propellers and 10 Motors. I need to select each Propeller and Motor and do Calculations and find Electric Power. the program should give the right combination of Propeller and Motor which gives least Electric Power. It has to go through all possible combinations for my calculation of Electric power. (Note: Propeller have 4 parameters, Motor have 3 parameters) .
Stephen23
Stephen23 2016년 8월 2일
편집: Stephen23 2016년 8월 2일
@Venkatesh Baskaran: Thanks for the information about what you have to do.
But you still haven't asked a question. What are you trying to find out from us ?
Venkatesh Baskaran
Venkatesh Baskaran 2016년 8월 2일
I want to find out the combination of 1 Propeller and 1 Motor for least Power, which is calculated using parameters from Prop & Motor.
Stephen23
Stephen23 2016년 8월 2일
편집: Stephen23 2016년 8월 2일
@Venkatesh Baskaran: I know what your task is. I don't know what your question is.
A question starts with the words "why", "what", "how", etc., and has a question mark at the end. For example:
"How do I write nested loops in MATLAB?"
"What is the best way to solve this task?"
"Can someone please write some code for me?"
"I tried to do XXX, why does it give result YYY when I expect ZZZ?"
I have no idea what you are struggling with, because so far you have only told us what your task is. But you have not asked us anything.
Venkatesh Baskaran
Venkatesh Baskaran 2016년 8월 2일
My Question: How to read each row from Propeller & Motor, then do calculations for Power. Store each Power output from all Prop_Motor combination in separate variables. From all Power output, how to select the min Power and how to display the corresponding Propeller and Motor combination.

댓글을 달려면 로그인하십시오.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 2일

0 개 추천

A=randi(100,100,4)
[n,m]=size(A)
for k=1:n % loop each row
r=A(k,:) % get the kth row
% Do
end

댓글 수: 3

Venkatesh Baskaran
Venkatesh Baskaran 2016년 8월 2일
I have 10 Propellers and 10 Motors. I need to select each Propeller and Motor and do Calculations and find Electric Power. the program should give the right combination of Propeller and Motor which gives least Electric Power. It has to go through all possible combinations for my calculation of Electric power. (Note: Propeller have 4 parameters, Motor have 3 parameters) .
Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 2일
Is this a question? then why have you accepted the answer?
Venkatesh Baskaran
Venkatesh Baskaran 2016년 8월 2일
I want to find out the combination of 1 Propeller and 1 Motor for least Power, which is calculated using parameters from Prop & Motor.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Thorsten
Thorsten 2016년 8월 2일

0 개 추천

If you want to multiply column 1 by alpha = 23 and add column 2, for example, you can to this as follows:
alpha = 23;
y = alpha*A(:,1) + A(:,2);
To find the minimum value and its index, use
[miny, idx] = min(y);

댓글 수: 1

Venkatesh Baskaran
Venkatesh Baskaran 2016년 8월 2일
I have 10 Propellers and 10 Motors. I need to select each Propeller and Motor and do Calculations and find Electric Power. the program should give the right combination of Propeller and Motor which gives least Electric Power. It has to go through all possible combinations for my calculation of Electric power. (Note: Propeller have 4 parameters, Motor have 3 parameters) .

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Specialized Power Systems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by