how to change format of outputs?

조회 수: 2 (최근 30일)
Samaneh Arzpeima
Samaneh Arzpeima 2019년 7월 4일
댓글: Walter Roberson 2019년 7월 8일
Hi
This is a continuation of my previous question
I have a vector name Z.mat(attached) which extracted from my simulation. I need to look for a specific value in it, 2.0785e+04.
Z vector format I guess is 「long e」,
cell number 5754 displaying 2.0785e+04 but when I clicked the cell its value is 2.083333000000000e+04
I can not find the value that I want because of the format difference I guess
I don't know how to fix the following code
survayline = 12*1000*tand(60);
% aspdepth=Y(Z==2.0785e+04);
aspdepth=Y(Z==20785e);
[aspdepth_sorted,aspdepth_order]=sort(aspdepth);
this code gives me
aspdepth []
aspdepth_order []
aspdepth_sorted []

채택된 답변

Walter Roberson
Walter Roberson 2019년 7월 4일
Individual elements of an array or object do not have formats. Most data types do not have formats that can be controlled by the user (but datetime and duration objects can be controlled per variable)
When you talk about clicking on a cell you are talking about using the Variable Browser. You can go into Preferences to change the default format used by the variable browser.
Changing the format in the variable browser, or by using the format command, never affects the content of the variable or how it compares to something else.
Your problem is that the value you are searching for does not exist in the array.
You should look at ismembertol()
  댓글 수: 2
Samaneh Arzpeima
Samaneh Arzpeima 2019년 7월 8일
thank you for the tips
though I couldn't figure it out yet.higher for my beginer level
Walter Roberson
Walter Roberson 2019년 7월 8일
[~,idx] = min(abs(Z-2.0785e+04));
Z(idx)
ans =
20833.33
Your target value is not in your Z array.

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by