필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

I have 5 data sets that I want to do calculations to and then plot separatly. Im trying to find a way to do these calculations without retyping my math 5 times with different variables each time. Is there a relativly easy way to do this?

조회 수: 1 (최근 30일)
I think the title says it all. Thanks!

답변 (1개)

John D'Errico
John D'Errico 2017년 2월 6일
편집: John D'Errico 2017년 2월 6일
Write your operations as a FUNCTION.
doc function
Save the function as a separate m-file on your search path.
Then just call your function 5 times.
Even better, is if you store your data in a cell array or array of structs, rather than 5 different sets of variables. Then you would need only use a loop, and you need not even write a separate function. Just put those operations inside a loop.
Best of all, read the getting started tutorials for MATLAB, where you will learn these things.
  댓글 수: 2
Bennett Torrance
Bennett Torrance 2017년 2월 6일
I think they are cell arrays. The value of one of them is 66540x24 double.
John D'Errico
John D'Errico 2017년 2월 6일
But are they an array of cell arrays? Cell arrays can be three dimensional, or they can contain other cell arrays.
The point is to use a loop. Don't store your data in separate arrays, if you will need to process each piece in one code.

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by