Answered

Insert 2 cell arrays in txt data

I think you need two %s separated by the tab: formatSpec='%s\t%s\n' and: fprintf(fid ,formatSpec, com1, com2); %witho...

Insert 2 cell arrays in txt data

I think you need two %s separated by the tab: formatSpec='%s\t%s\n' and: fprintf(fid ,formatSpec, com1, com2); %witho...

plus de 2 ans ago | 0

| accepted

Answered

Label more than 7 lines in a plot

Hi, one solution is to plot in different lines styles: hold on; plot(matA(:,1:7), '-'); plot(matA(:,8:14), '--'); ....

Label more than 7 lines in a plot

Hi, one solution is to plot in different lines styles: hold on; plot(matA(:,1:7), '-'); plot(matA(:,8:14), '--'); ....

environ 3 ans ago | 0

Solved

Pizza!

Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

environ 3 ans ago

Answered

How to Have an ANSWER that would depend upon the LETTER of your INPUT? Plz help me. thank you

Here is a little help function output = your_function(str) unit = str(end); %should be 'F' or 'C' val = str2doub...

How to Have an ANSWER that would depend upon the LETTER of your INPUT? Plz help me. thank you

Here is a little help function output = your_function(str) unit = str(end); %should be 'F' or 'C' val = str2doub...

environ 3 ans ago | 0

Answered

Why am i unable to define syms function in matlab?

Check with ver if you have the Symbolic Math Toolbox installed. It is also possible, if you are using a shared license, ...

Why am i unable to define syms function in matlab?

Check with ver if you have the Symbolic Math Toolbox installed. It is also possible, if you are using a shared license, ...

plus de 3 ans ago | 0

Answered

adding index to matrix rows

Is this what you want? Or what do you mean with ':' in a matrix? A = [1 0; 0 2; 2 1; 0 3; 3 2; ...

adding index to matrix rows

Is this what you want? Or what do you mean with ':' in a matrix? A = [1 0; 0 2; 2 1; 0 3; 3 2; ...

plus de 3 ans ago | 0

Answered

Plotting and storing results from a while loop.

I think you already have the answer in your code. The problem is that you are overwriting T in the following line T = T_end ...

Plotting and storing results from a while loop.

I think you already have the answer in your code. The problem is that you are overwriting T in the following line T = T_end ...

plus de 3 ans ago | 0

Answered

Anyone know where I can find the source code for conv2.m?

According to type conv2 this is a built-in function (like mean, max, sum, etc), not a funtion programmed as a .m file. W...

Anyone know where I can find the source code for conv2.m?

According to type conv2 this is a built-in function (like mean, max, sum, etc), not a funtion programmed as a .m file. W...

plus de 3 ans ago | 0

| accepted

Answered

From string to matrix name

str = [name '(2,2) = 3']; eval(str); you could also try to define the tables as a cell array to avoid using eval for n...

From string to matrix name

str = [name '(2,2) = 3']; eval(str); you could also try to define the tables as a cell array to avoid using eval for n...

plus de 3 ans ago | 0

Answered

How to add negative number to the and of rand function

Assuming x is your 9x5 random matrix: out = [x (-1:-1:-9)']; is this what you want?

How to add negative number to the and of rand function

Assuming x is your 9x5 random matrix: out = [x (-1:-1:-9)']; is this what you want?

plus de 3 ans ago | 0

Answered

How to allocate the content of a M*1 vector to a T*N matrix (M<T*N) ? problem with cell format

If you preallocate past: past = NaN(10,1); then you should use past(n,1) = id{n,1}; instead of past{n,1} = id...

How to allocate the content of a M*1 vector to a T*N matrix (M<T*N) ? problem with cell format

If you preallocate past: past = NaN(10,1); then you should use past(n,1) = id{n,1}; instead of past{n,1} = id...

plus de 3 ans ago | 0

Answered

User input and print question

Try using fprintf with \b (backspace) to "remove" the newline density = input('Air density = '); fprintf('\b kg/m^3\n'); ...

User input and print question

Try using fprintf with \b (backspace) to "remove" the newline density = input('Air density = '); fprintf('\b kg/m^3\n'); ...

plus de 3 ans ago | 0

Answered

Logical indexing without for loop

j = [0 A(2:end) > A(1:end-1)]

Logical indexing without for loop

j = [0 A(2:end) > A(1:end-1)]

plus de 3 ans ago | 1

| accepted

Answered

Focus on a certain Subplot

Hello you can save the step output in variables and then plot the ones you are interested in: [y,t] = step(sys); input ...

Focus on a certain Subplot

Hello you can save the step output in variables and then plot the ones you are interested in: [y,t] = step(sys); input ...

plus de 3 ans ago | 1

| accepted

Answered

Is it possible to transform a string to a variable code name in MATLAB?

x = eval(v_str); It is normal to advice against it, but normally when the left side of the equation is a string

Is it possible to transform a string to a variable code name in MATLAB?

x = eval(v_str); It is normal to advice against it, but normally when the left side of the equation is a string

plus de 3 ans ago | 0

Answered

Constructing saved file name with variables from code

Do you meansomething like this? ext = '.mat'; %or .cvs, .xlsx, ... file_name = ['Test_File_' datestr(now,30) '_' num2st...

Constructing saved file name with variables from code

Do you meansomething like this? ext = '.mat'; %or .cvs, .xlsx, ... file_name = ['Test_File_' datestr(now,30) '_' num2st...

plus de 3 ans ago | 0

Answered

Script for plotting two graphs on the same window

hold on should work: hold on plot(x1, y1, 'b') plot(x2, y2, 'r')

Script for plotting two graphs on the same window

hold on should work: hold on plot(x1, y1, 'b') plot(x2, y2, 'r')

plus de 3 ans ago | 0

Answered

MATLAB displays a blank graph when I plot try to plot

Since you are plotting single dots ( plot in a for loop) the dots aren't connected. Just try: x=3; y=(x^3)*cos(x); d...

MATLAB displays a blank graph when I plot try to plot

Since you are plotting single dots ( plot in a for loop) the dots aren't connected. Just try: x=3; y=(x^3)*cos(x); d...

plus de 3 ans ago | 0

Answered

xlsread not able to reference my sheet names.

The name of the sheet should be a string. You should use then: DATA = xlsread('DATA1.xlsx', '12') If you use a number it ...

xlsread not able to reference my sheet names.

The name of the sheet should be a string. You should use then: DATA = xlsread('DATA1.xlsx', '12') If you use a number it ...

presque 4 ans ago | 0

Answered

Read multiple excel file and write into single excel file

hello you can try this. source_dir = 'C:\Users\sourcedir.....' %my file source dir dest_dir = 'C:\Users\destdir..........

Read multiple excel file and write into single excel file

hello you can try this. source_dir = 'C:\Users\sourcedir.....' %my file source dir dest_dir = 'C:\Users\destdir..........

presque 4 ans ago | 1

| accepted

Answered

Creating a loop for genearating matrix

Hi. I hope this is what you need N = length(y); %should be 301 for i = 1:5 Y{i} = y(i+1:N); tmpY = []; ...

Creating a loop for genearating matrix

Hi. I hope this is what you need N = length(y); %should be 301 for i = 1:5 Y{i} = y(i+1:N); tmpY = []; ...

presque 4 ans ago | 0

| accepted

Answered

Export from workspace to simulink

Simulink -> sources -> constant if you have a constant in the workspace. You just need to write the name of the variable insi...

Export from workspace to simulink

Simulink -> sources -> constant if you have a constant in the workspace. You just need to write the name of the variable insi...

presque 4 ans ago | 0

Answered

force code gui on start up

you could call the function manually. my_function([], []) and if your function use for example the event e, you can set ...

force code gui on start up

you could call the function manually. my_function([], []) and if your function use for example the event e, you can set ...

presque 4 ans ago | 0

| accepted

Answered

how to merge two mat files which have different structure cells into a mat file with a matrix

I think this should do it: for i = 1:N A = load(file_i); A = struct2cell(A); f{i} = cat(1,A{:}) end combi...

how to merge two mat files which have different structure cells into a mat file with a matrix

I think this should do it: for i = 1:N A = load(file_i); A = struct2cell(A); f{i} = cat(1,A{:}) end combi...

presque 4 ans ago | 0

| accepted

Answered

How can I import, extract, and average certain data from a excel/csv file?

This should get 2 arrays (S_vals, Q_vals) for the values of S and Q in the file and help as a start point. If you need more help...

How can I import, extract, and average certain data from a excel/csv file?

This should get 2 arrays (S_vals, Q_vals) for the values of S and Q in the file and help as a start point. If you need more help...

presque 4 ans ago | 0

| accepted

Answered

How to write this logic in MATLAB..?

new_x = x + [0;x(1:end-1)];

How to write this logic in MATLAB..?

new_x = x + [0;x(1:end-1)];

presque 4 ans ago | 1

| accepted

Answered

How to get my for loop working?

I think you should use Duration(d,s) = ... %not Duration(d,1) or maybe what you want is Duration(d,1) = length(IndexM...

How to get my for loop working?

I think you should use Duration(d,s) = ... %not Duration(d,1) or maybe what you want is Duration(d,1) = length(IndexM...

presque 4 ans ago | 0

Answered

How can I do this : { [5] [6] [7] [8:23] [24:39] [40:55] } --- these number are just an example

Do you want something like this? ['[' strc(1) ':' strc(4) ']']

How can I do this : { [5] [6] [7] [8:23] [24:39] [40:55] } --- these number are just an example

Do you want something like this? ['[' strc(1) ':' strc(4) ']']

presque 4 ans ago | 0

Answered

Find column names with particular names in MATLAB table

Hello if "titles" is the first row of your table, then: titles = finalnbs(1,:); %Select the columns that should stay ...

Find column names with particular names in MATLAB table

Hello if "titles" is the first row of your table, then: titles = finalnbs(1,:); %Select the columns that should stay ...

presque 4 ans ago | 0

Answered

Simulink frequency input for sine block

Hi. You could set the internal frequency of the sine function to 1 and multiply the input signal by the desired frequency

Simulink frequency input for sine block

Hi. You could set the internal frequency of the sine function to 1 and multiply the input signal by the desired frequency

presque 4 ans ago | 0