Answered

What code to make figure window fullscreen with subplot?

You can use my maximize FEX submission, and/or if you're using R2018a or later you can set the WindowState property (see the doc...

What code to make figure window fullscreen with subplot?

You can use my maximize FEX submission, and/or if you're using R2018a or later you can set the WindowState property (see the doc...

19 giorni ago | 0

| accepted

Answered

How to do a baseline correction

You mean like a simple subtraction? t=linspace(0,10,100); bias=@(t) t/9; P_fun=@(t) 0.1*(t-3).^2+sin(t/2)-0.85 +bias(t); P=P...

How to do a baseline correction

You mean like a simple subtraction? t=linspace(0,10,100); bias=@(t) t/9; P_fun=@(t) 0.1*(t-3).^2+sin(t/2)-0.85 +bias(t); P=P...

19 giorni ago | 0

| accepted

Answered

Find where line crosses y = 1 and y = 0

Basic algebra which doesn't have a lot to to with Matlab: A=4;B=9;%example input y=[0 1]; x=(y-B)./A; clc,disp(x)

Find where line crosses y = 1 and y = 0

Basic algebra which doesn't have a lot to to with Matlab: A=4;B=9;%example input y=[0 1]; x=(y-B)./A; clc,disp(x)

19 giorni ago | 1

Answered

How to resize a 4D Matrix

You misunderstood the syntax of the FEX submission imresizen. The second input is a scaling factor, meaning your syntax should l...

How to resize a 4D Matrix

You misunderstood the syntax of the FEX submission imresizen. The second input is a scaling factor, meaning your syntax should l...

20 giorni ago | 0

| accepted

Answered

Creating Gui in matlab

I would recommend not using GUIDE. The point where GUIDE will be removed from Matlab is now on the horizon, and you shouldn't be...

Creating Gui in matlab

I would recommend not using GUIDE. The point where GUIDE will be removed from Matlab is now on the horizon, and you shouldn't be...

20 giorni ago | 0

Answered

How can I get a first value of each index from the other column?

Use unique to get the list of first indices, the use either find or min in a loop.

How can I get a first value of each index from the other column?

Use unique to get the list of first indices, the use either find or min in a loop.

20 giorni ago | 0

| accepted

Answered

How to integrate a plot over specified range?

As you indicated with the tags, using trapz is also an option. fun_x_of_t=@(t) sin(t); fun_y_of_x=@(x) cos(x); fun_y_of_t=@(t...

How to integrate a plot over specified range?

As you indicated with the tags, using trapz is also an option. fun_x_of_t=@(t) sin(t); fun_y_of_x=@(x) cos(x); fun_y_of_t=@(t...

22 giorni ago | 1

Answered

Load in all files of a folder?

Use dir to generate a file list (you can use ** to search a folder tree), then use a loop to process all files one by one.

Load in all files of a folder?

Use dir to generate a file list (you can use ** to search a folder tree), then use a loop to process all files one by one.

22 giorni ago | 0

| accepted

Answered

What is the return key mac

You could check if char(10) or char(13) would work.

What is the return key mac

You could check if char(10) or char(13) would work.

24 giorni ago | 0

Answered

How to horizontally align multiple lines ylabel

(untested idea) You can trick the alignment by making sure the square bracket part is the middle line. To achieve this you ca...

How to horizontally align multiple lines ylabel

(untested idea) You can trick the alignment by making sure the square bracket part is the middle line. To achieve this you ca...

24 giorni ago | 0

Answered

Sort a structure by the date field

Don't concatenate to a cell, but to an array: examplestruct = struct; for i = 1:5 examplestruct(i).data = rand(1,10); en...

Sort a structure by the date field

Don't concatenate to a cell, but to an array: examplestruct = struct; for i = 1:5 examplestruct(i).data = rand(1,10); en...

25 giorni ago | 0

| accepted

Answered

How can I find the maximum value and time array in MATLAB?

Use the second output of max: a = [1 2 ; 4 5 ; 7 8 ; 6 11 ; 4 3 ]; [val,ind]=max(a(:,2)); time_val=a(ind,1);

How can I find the maximum value and time array in MATLAB?

Use the second output of max: a = [1 2 ; 4 5 ; 7 8 ; 6 11 ; 4 3 ]; [val,ind]=max(a(:,2)); time_val=a(ind,1);

25 giorni ago | 0

Answered

plotting a function from an m file

You forgot to add 100 in your actual code: plot(x,f(x,100)) You should avoid using sum as a variable name, because it sh...

plotting a function from an m file

You forgot to add 100 in your actual code: plot(x,f(x,100)) You should avoid using sum as a variable name, because it sh...

25 giorni ago | 0

Answered

Saving structure as a .mat file with matrices, strings and numbers

There are two issues here. If you read the doc it specifies that the struct must be scalar (each field is allowed to be any type...

Saving structure as a .mat file with matrices, strings and numbers

There are two issues here. If you read the doc it specifies that the struct must be scalar (each field is allowed to be any type...

25 giorni ago | 0

| accepted

Answered

How to increment a subscript in Matlab using the ylabel function?

The syntax you are attempting to use would work if you're using strings. However, you are using char arrays. Either switch to a ...

How to increment a subscript in Matlab using the ylabel function?

The syntax you are attempting to use would work if you're using strings. However, you are using char arrays. Either switch to a ...

25 giorni ago | 0

| accepted

Answered

How to code fprintf on multiple lines ?

As far as I'm aware this should work with strings as well, but I frequently use a setup like this with a char array instead. So ...

How to code fprintf on multiple lines ?

As far as I'm aware this should work with strings as well, but I frequently use a setup like this with a char array instead. So ...

26 giorni ago | 1

| accepted

Answered

Insert PNG image into normal image

If you want to prevent overwriting the underlying image for some pixels, you can use a logical mask to only overwrite some pixel...

Insert PNG image into normal image

If you want to prevent overwriting the underlying image for some pixels, you can use a logical mask to only overwrite some pixel...

26 giorni ago | 0

Answered

Write data to text file

This is probably due to Matlab being column-based, instead of row-based. This may result in counterintuitive results if you ente...

Write data to text file

This is probably due to Matlab being column-based, instead of row-based. This may result in counterintuitive results if you ente...

27 giorni ago | 1

| accepted

Answered

Cell to matrix average

Something like this should work for you: %generate some example data data=cell(93,1); for n=1:93 data{n}=rand(45,147,19)...

Cell to matrix average

Something like this should work for you: %generate some example data data=cell(93,1); for n=1:93 data{n}=rand(45,147,19)...

27 giorni ago | 0

Answered

How do you use ls to change your directory in Matlab?

The homework is either badly designed, or is attempting to teach you why you shouldn't use it. You shouldn't change your curren...

How do you use ls to change your directory in Matlab?

The homework is either badly designed, or is attempting to teach you why you shouldn't use it. You shouldn't change your curren...

27 giorni ago | 0

| accepted

Answered

Standard Deviation of 3D matrix with NaN elements

This syntax should work for most releases: sdev=std(m(:),'omitnan');

Standard Deviation of 3D matrix with NaN elements

This syntax should work for most releases: sdev=std(m(:),'omitnan');

27 giorni ago | 0

Answered

Picking files according to file names

Use the dir function to generate a list of files, then parse the file names in a loop and continue to read the relevant files.

Picking files according to file names

Use the dir function to generate a list of files, then parse the file names in a loop and continue to read the relevant files.

28 giorni ago | 0

| accepted

Answered

Finding consecutive data with non zero in array

I used the mfile version of Jan's FEX submission RunLength, because I can't get my compiler to work right now. With the runlegth...

Finding consecutive data with non zero in array

I used the mfile version of Jan's FEX submission RunLength, because I can't get my compiler to work right now. With the runlegth...

28 giorni ago | 0

Answered

randomly divide vector into 2 parts.

I don't fully understand every step of your code, so I rewrote it: index_rating=rand(100000,5);%generate example data training...

randomly divide vector into 2 parts.

I don't fully understand every step of your code, so I rewrote it: index_rating=rand(100000,5);%generate example data training...

29 giorni ago | 0

| accepted

Answered

imread not working for gif problem

It took some digging with the debugger, but with enough breakpoints I was able to track down the cause. Your calls are failing b...

imread not working for gif problem

It took some digging with the debugger, but with enough breakpoints I was able to track down the cause. Your calls are failing b...

29 giorni ago | 2

| accepted

Answered

write a range on the y-axis

You can modify the XTickLabels property to display any char array. figure(1),clf(1)%only use clf during debugging ax=axes; pl...

write a range on the y-axis

You can modify the XTickLabels property to display any char array. figure(1),clf(1)%only use clf during debugging ax=axes; pl...

29 giorni ago | 0

| accepted

Answered

How can I run a Matlab script at the same time everyday?

It is probably easiest to use the options your OS provides and run a headless instance of Matlab. On Windows you can use the tas...

How can I run a Matlab script at the same time everyday?

It is probably easiest to use the options your OS provides and run a headless instance of Matlab. On Windows you can use the tas...

circa un mese ago | 0

Answered

Changing data from long form to short form

You can use the participant ID and trial ID as the indices and either use accumarray or sub2ind to fill the matrix with the valu...

Changing data from long form to short form

You can use the participant ID and trial ID as the indices and either use accumarray or sub2ind to fill the matrix with the valu...

circa un mese ago | 1

Answered

How to count the number of voxels of another color

Similar to how you would do that for 2D: IM=randi(255,[512 512 400]); count=sum(IM==200,'all'); %if your release doesn't ha...

How to count the number of voxels of another color

Similar to how you would do that for 2D: IM=randi(255,[512 512 400]); count=sum(IM==200,'all'); %if your release doesn't ha...

circa un mese ago | 0

| accepted

Answered

Save data from MatLab GUI to struct .mat file

You should always load to a struct. That makes it clear where variables come from. Then it is also easier to extend the struct i...

Save data from MatLab GUI to struct .mat file

You should always load to a struct. That makes it clear where variables come from. Then it is also easier to extend the struct i...

circa un mese ago | 1

| accepted