필터 지우기
필터 지우기

Set empty vector equal to zero?

조회 수: 9 (최근 30일)
JE
JE 2015년 10월 15일
답변: Walter Roberson 2015년 10월 15일
I have a cell array that is empty.
I want to create an if then statement that would let me set any vector that turns out to be empty..to equal zero.
I've tried using the null statement, but I'm running into problems. Does anyone know how I could do this? It does not have to be an if then statement.
  댓글 수: 2
the cyclist
the cyclist 2015년 10월 15일
It may seem to you that you are stating your problem clearly, but I for one do not really understand at all what you are trying to do. Remember, we don't know anything at all about your problem, except what you say here.
Can you give an example of the input you have, and the output you expect from the algorithm you want. Can you show us the code you have that is not working, and describe what specifically went wrong?
JE
JE 2015년 10월 15일
편집: Walter Roberson 2015년 10월 15일
Sorry!
stopcodon1 =
{[]}
if 1==isempty(stopcodon1)
stopcodon1=0;
end
My most recent attempt to make stopcodon=0. And it didn't seem to do anything.

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

답변 (1개)

Walter Roberson
Walter Roberson 2015년 10월 15일
idx = cellfun(@isempty, stopcodon1);
stopcodon1(idx) = {0};

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by