필터 지우기
필터 지우기

how to disp array

조회 수: 4 (최근 30일)
hamid shakeri
hamid shakeri 2014년 11월 15일
댓글: Star Strider 2014년 11월 15일
Hi everyone,
this is part of my code, I want to display LoadCase array (for example: HighWind).
LoadCase=input('Please specify the loading condition number (HighWind/HeavyIce/BrokenWire) ! ');
disp(LoadCase)
I don't know how;please help me.
Thanks.
  댓글 수: 4
Geoff Hayes
Geoff Hayes 2014년 11월 15일
Hamid - are HighWind, HeavyIce, BrokenWire local variables in your code? Are they arrays, scalars, or something else? In the Command Window, just after running the above code, type
whos
to display all local variables, their sizes, etc.
hamid shakeri
hamid shakeri 2014년 11월 15일
size:1*1 , Bytes:8 , Class:double

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

채택된 답변

Star Strider
Star Strider 2014년 11월 15일
I would use the inputdlg function instead. It’s easier, and doesn’t clutter the Command Window:
LoadCase=inputdlg('Please specify the loading condition number (HighWind/HeavyIce/BrokenWire) ! ');
LoadCase = str2num(LoadCase{:})
This asks for and then displays your ‘LoadCase’ variable. Remember that ‘LoadCase’ is a cell, so if the response is supposed to be a number, you need to convert it to a double as I did here with the str2num function.
If the response is expected to be a string and not a number, use this to convert it to a string:
LoadCase = char(LoadCase)
Cell arrays are extremely useful, but in most instances it is necessary to convert them into another variable type to use their elements.
  댓글 수: 8
hamid shakeri
hamid shakeri 2014년 11월 15일
You are the best, Thank you very much.
Star Strider
Star Strider 2014년 11월 15일
My pleasure! And thank you for the compliment!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by