1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Schach [20]
3 years ago
15

Create a separate function file fieldtovar.m that receives a single structure as an input and assigns each of the field values t

o user-defined variables. The function should work for a structure with any number of fields. Additionally, implement an error check to ensure that the number of userdefined variables (output arguments) is equal to the number of structure fields.
Engineering
1 answer:
Soloha48 [4]3 years ago
4 0

Answer:

Explanation gives the answer

Explanation:

% Using MATLAB,

% Matlab file : fieldtovar.m

function varargout = fieldtovar(S)

% function that accepts single structure as input, assigning each

% of the field values to user-defined variables

fields = fieldnames(S); % get the field names of the input structure

% check if number of user-defined variables and number of fields in

% structure are equal

if nargout == length(fields)

% if equal assign each value of structure to user-defined varable

for i=1:nargout

varargout{i} = getfield(S,fields{i});

end

else

% if not equal display an error message

error('The number of output variables does not equal the number of fields');

end

end

%This brings an end to the program

You might be interested in
3. Briefly explain the conduction mechanism in metals?​
Bingel [31]

Answer:

conduction occurs when a substance is heated

Explanation:

3 0
2 years ago
Given a matrix, clockwise-rotate elements in it. Please add code to problem3.cpp and the makefile. Use the code in p3 to test yo
rusak2 [61]

Answer:

/* C Program to rotate matrix by 90 degrees */

#include<stdio.h>

int main()

{

int matrix[100][100];

int m,n,i,j;

printf("Enter row and columns of matrix: ");

scanf("%d%d",&m,&n);

 

/* Enter m*n array elements */

printf("Enter matrix elements: \n");

for(i=0;i<m;i++)

{

 for(j=0;j<n;j++)

 {

  scanf("%d",&matrix[i][j]);

 }

}

 

/* matrix after the 90 degrees rotation */

printf("Matrix after 90 degrees roration \n");

for(i=0;i<n;i++)

{

 for(j=m-1;j>=0;j--)

 {

  printf("%d  ",matrix[j][i]);

 }

 printf("\n");

}

 

return 0;

 

}

5 0
3 years ago
What is the diffrence between a small block and a big block lets see if yall know
ivann1987 [24]

Answer:

The difference in weight and size?

Explanation:

It explains itself :P

5 0
2 years ago
If you need to write a function that will compute the cost of some candy, where each piece costs 25 cents, which would be an app
masya89 [10]
The best answer would be

D. Int calculateCost(int count);
6 0
3 years ago
4. In the Hyatt Regency walkway case study, it is reported that Jack Gillum stamps the 42 shop drawings, including the revised S
mario62 [17]

Answer:

Responsibility

Explanation:

By stamping the drawings that he was looking over, Jack Gillum conveys the fact that he is accepting responsibility for this work. The purpose of Gillum's stamp is to explain that such work has been under engineering review, and that it has fulfilled all the requirements that he watches our for. By putting his stamp in this work, Gillum accepts responsibility in case an error or a discrepancy is found in the drawings.

3 0
3 years ago
Other questions:
  • In order to protect yourself if you have a dispute with another drivers insurance company you should:
    9·1 answer
  • Both carpenters and building inspectors have been associated with the personality characteristics identified as realistic, conve
    12·1 answer
  • Find the difference between the first and third angle projection type.
    11·1 answer
  • A rigid tank contains 5 kg of saturated vapor steam at 100°C. The steam is cooled to the ambient temperature of 25°C. (a) Sketch
    5·1 answer
  • I have a stream with three components, A, B, and C, coming from another process. The stream is 50 % A, and the balance is equal
    11·1 answer
  • Refrigerant 134a enters a horizontal pipe operating at steady state at 40°C, 300 kPa, and a velocity of 25 m/s. At the exit, the
    11·1 answer
  • Consider the equation y = 10^(4x). Which of the following statements is true?
    9·1 answer
  • The distribution of SAT scores of all college-bound seniors taking the SAT in 2014 was approximately normal with mean μ=1497 and
    12·1 answer
  • Chemical engineers determine how to transport chemicals.<br> O True<br> False
    8·2 answers
  • 9. A piece of Cherry wood is 5/4 x 4" X 4'<br> What is the length in inches?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!