how to disp array

8 views (last 30 days)
hamid shakeri
hamid shakeri on 15 Nov 2014
Commented: Star Strider on 15 Nov 2014
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 Comments
hamid shakeri
hamid shakeri on 15 Nov 2014
size:1*1 , Bytes:8 , Class:double

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 15 Nov 2014
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 Comments
Star Strider
Star Strider on 15 Nov 2014
My pleasure! And thank you for the compliment!

Sign in to comment.

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by