Question

Why Do I Get This Error for This Non-scalar Structure?

I have this struct: A(1).B.C = 'a'; A(2).B.C = 'b'; A(3).B.C = 'a'; When I execute the code below, it works A...

ungefär 6 år ago | 4 answers | 0

Question

How to Change Values of a Field by an Indexing Array?

Here’s my initial struct: A(1).B.C = 'a'; A(2).B.C = 'b'; A(3).B.C = 'a'; A(4).B.C = 'a'; I want to change the...

ungefär 6 år ago | 1 answer | 0

Question

How to Access to Fields of a Non-scalar Struct?

How can I create the 4-by-1 cell array D from the struct A? A(1).B.C = 'a'; A(2).B.C = 'b'; A(3).B.C = 'c'; A(4).B...

ungefär 6 år ago | 1 answer | 0

Question

How Does This Short Code Work?

How is D calculated? Could you explain the steps that MATLAB takes to calculate D? Is it only for logical values or can be ex...

ungefär 6 år ago | 1 answer | 0

Question

How to Put an Arrays Elements in a Structure?

Is there any way to get as same a result as the code below without having that annoying for loop? A = [1; 1; 0; 0; 0; 0; 1]...

ungefär 6 år ago | 1 answer | 0

Question

A Message Box for a Nested Loop to Report Progress?

I have a nested loop that takes minutes to finish. I want to put a piece of code in the position of Statement2 to know about the...

ungefär 6 år ago | 1 answer | 0

Question

How to Get the File Name and Store a File into a Struct While Using the Function uiopen?

I want to do two extra things while calling uiopen function. 1) How can I get the file that is opened? For example, I open A...

ungefär 6 år ago | 1 answer | 0

Question

How to Keep Objects Organized while Maximizing a Figure?

Objects look fine on a figure until I maximize the figure. How can manage the position of objects when I maximize or generally c...

ungefär 6 år ago | 1 answer | 0

Question

How to Manage the Order of Graphics Objects and Plots on an Axes Object?

How to manage to specify the order of p1,r1, and r2? For example, how can I put p1 between r1 and r2? f = figure; ...

ungefär 6 år ago | 1 answer | 0

Question

Easiest Way to Assign Graphics Objects to a 1-by-n Struct?

How to assign graphics objects to a 1-by-5 struct field? Is there an easier way than using a for loop and assign the values elem...

ungefär 6 år ago | 1 answer | 0

Question

How to Put These Vectors in a Matrix?

A.B.G = [1 2 3]; A.C.G = [4 5 6]; A.D.G = [7 8 9]; A.E.G = [10 11 12]; A.F.G = [13 14 15]; so it will look li...

ungefär 6 år ago | 1 answer | 0

Question

How to Use a For Loop to Dynamically Assign the Values of Struct Fields to a Matrix?

How to use a for loop to dynamically assign the values of fields C, D, and G to a matrix? if for loop is not possible, what e...

ungefär 6 år ago | 1 answer | 0

Question

How to Exclude Some Fields While Using the Function structfun?

A.B.C = [1 2 3]; A.B.D = [3 4 5]; A.B.E = [6 7 8]; How to exclude A.B.E from the calculation and just get the sums o...

ungefär 6 år ago | 2 answers | 0

Question

What Is the Definition of Scalar Structure?

What Is the Definition of Scalar Structure?

ungefär 6 år ago | 1 answer | 1

Question

How to Assign Values from a Struct to a Matrix in a For Loop?

A.B.C = [1 2 3]; A.B.D = [3 4 5]; for k = 1:2 G(k, :) = A.B.C; G(k, :) = A.B.D; end G G returns: ...

ungefär 6 år ago | 1 answer | 0

Question

How to Assign a Struct Field to a Matrix?

How can it assign field C and field D to the first and second rows of G, respectively? A.B.C = [1 2 3]; A.B.D = [3 4 5];...

ungefär 6 år ago | 1 answer | 0

Question

How to Read this Code in English?

I am not an English-speaking person. How is the correct way to describe the code below with words? A.B.C = 1

ungefär 6 år ago | 1 answer | 0

Question

How MATLAB Reads an M File?

I have the two following functions in a MATLAB M File. Am I right that when you run an M File in Matlab, MATLAB ALWAYS executes ...

ungefär 6 år ago | 1 answer | 0

Question

How to Expand an Existing Structure Array?

As a simple example, I create the struct B with one field: B.D = 1; How do I set parent struct A for the above-ment...

mer än 6 år ago | 1 answer | 0

Question

How to Assign These Values to This Struct?

As an example, I want to dynamically assign four output arguments of ttest function to four field of struct A, but I get the err...

mer än 6 år ago | 1 answer | 0

Question

Why Isn’t One of Plots Shown?

I have some questions regarding the code below hax1 = axes('OuterPosition', [0 0 0.5 0.5]); hax2 = axes('OuterPositi...

mer än 6 år ago | 1 answer | 0

Question

How to Define a Default Input Argument for a Function?

How to define a default input argument for a function? I want to set a default input argument which will be replaced later by ne...

mer än 6 år ago | 1 answer | 0

Question

How to Directly Plot Spherical Coordinates?

Is there any way to plot spherical coordinates (theta, phi, rho) without first converting them into Cartesian coordinates?

mer än 6 år ago | 1 answer | 0

Question

How to Create a Column Vector of a Field of a Struct?

How to create column vectors out of B (i.e., D = [10;20;30]) and C (i.e., E = [100;200;300])? A(1).B = 10; A(2).B = 20; ...

mer än 6 år ago | 1 answer | 0

Question

How to Access a Variable's Value in a Nested Function?

How Can I see the value of variable g in Command window and Workspace? function parentfcn(b) a = b+1 function chi...

mer än 6 år ago | 1 answer | 0

Question

How to Execute Something When a Graphics Object is Left-Clicked?

I want the red rectangle to turn green when I only “left-click” (not right-click or middle click) on it. What is the easiest sol...

mer än 6 år ago | 1 answer | 0

Question

Hovering on an Graphics Object

I want the red rectangle to turn green while I'm hovering the mouse over it. How? hax = axes('XLim', [0 4], 'YLim', [0 4]);...

mer än 6 år ago | 1 answer | 0

Question

How to Call Context Menu from Inside a Rectangle?

To call the context menu, I have to right-click exactly on the outline of the circle. Is there any way to call the rectangle whe...

mer än 6 år ago | 1 answer | 0

Question

How to access a field of a struct by indexing?

I have a 1-by-1 struct that possesses 3 fields named B, C, and D. Is there any way to call D by its index (i.e., D is the third ...

mer än 6 år ago | 2 answers | 2

Question

How to Suppress a Function?

When I run the code below, MATLAB runs it and I get the error “Not enough input arguments”. Isn’t there any way to tell MATLAB t...

mer än 6 år ago | 1 answer | 0