matlab GUI中的新屏幕

时间:2017-12-05 10:31:06

标签: matlab matlab-guide

如何在MATLAB中创建GUI,单击按钮时会更改为新界面(新屏幕)。

我有一个生成某个图形的程序,我希望当我点击一个按钮时,它会将GUI的屏幕更改为另一个带有另一个图形的图形。

1 个答案:

答案 0 :(得分:1)

在MATLAB中保存GUI时,有两个文件。一个是fig文件,它是用户设计的图形,即图片。另一个是包含代码的m文件。两个数字之间没有关系。这与C#和其他语言完全不同。所以,我们认为这个m文件是一个独立的程序。要执行它,我们使用以下代码运行它。

    <div id="price-calculation-view">
   <div id="price_calculation">
      <div class="col-lg-2 main"><input type="text" value="Newspaper" readonly="" class="form-control"></div>
      <div class="col-lg-2 main"><input type="text" name="price" id="price-3" value="9" readonly="" class="form-control" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-2 main"><input type="text" value="" name="qty" id="qty-3" class="form-control qty" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-2 main"><input type="text" name="amount" id="amount-3" value="" readonly="" class="form-control amount" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-3 main"><input type="text" name="id" id="ids-3" value="3" readonly="" class="form-control"></div>
   </div>
   <div id="price_calculation">
      <div class="col-lg-2 main"><input type="text" value="Cardboards (flattened)" readonly="" class="form-control"></div>
      <div class="col-lg-2 main"><input type="text" name="price" id="price-4" value="5" readonly="" class="form-control" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-2 main"><input type="text" value="" name="qty" id="qty-4" class="form-control qty" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-2 main"><input type="text" name="amount" id="amount-4" value="" readonly="" class="form-control amount" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-3 main"><input type="text" name="id" id="ids-4" value="4" readonly="" class="form-control"></div>
   </div>
   <div id="price_calculation">
      <div class="col-lg-2 main"><input type="text" value="Glass Bottles (Unbroken)" readonly="" class="form-control"></div>
      <div class="col-lg-2 main"><input type="text" name="price" id="price-5" value="0.4" readonly="" class="form-control" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-2 main"><input type="text" value="" name="qty" id="qty-5" class="form-control qty" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-2 main"><input type="text" name="amount" id="amount-5" value="" readonly="" class="form-control amount" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-3 main"><input type="text" name="id" id="ids-5" value="5" readonly="" class="form-control"></div>
   </div>
   <div id="price_calculation">
      <div class="col-lg-2 main"><input type="text" value="Plastic bottles" readonly="" class="form-control"></div>
      <div class="col-lg-2 main"><input type="text" name="price" id="price-6" value="11" readonly="" class="form-control" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-2 main"><input type="text" value="" name="qty" id="qty-6" class="form-control qty" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-2 main"><input type="text" name="amount" id="amount-6" value="" readonly="" class="form-control amount" onkeypress="return isNumber(event)"></div>
      <div class="col-lg-3 main"><input type="text" name="id" id="ids-6" value="6" readonly="" class="form-control"></div>
   </div>

</div>