Respondida
reading a binary file into matlab
I think there're other issues despite fixing fid = fopen(fname) filelist = dir('E:\4_models\model1'); filelist = filelist(...

más de 7 años hace | 0

Respondida
Conversion to cell from double is not possible
If you want the output to be a cell in the case 2, you have to do this onset_time_second = cell(ratio_channels,4); onset...

más de 7 años hace | 0

| aceptada

Respondida
How do I use the command 'smooth' to smooth a plot of data I have pulled from two matrices?
Assuming Tmatrix is a 1xN or Mx1 matrix, your use of smooth is correct. But note that you are doing smoothing ONLY on cloudy day...

más de 7 años hace | 0

Respondida
Why is my scatter plot blank?
scatter([1 2 3], [1 2 3]); set(gcf, 'renderer', 'painters') Sometimes there's a bug that prevents the graphics card from p...

más de 7 años hace | 0

| aceptada

Respondida
Using parfor and parfeval in separate pools
I don't think it'll be beneficial nor possible. I get an error like this, since you can't have multiple pools running. Matlab wo...

más de 7 años hace | 0

| aceptada

Respondida
How to go through multiple different naming folders for the same subfolder name
MainDir = dir(cd); %Instead of cd, use the folder storing your main folders MainDir = MainDir([MainDir.isdir]); %Select onl...

más de 7 años hace | 0

| aceptada

Respondida
Problem with cell array indexing when using parfor
On first glance, here are some issues. Rewrite the code to prevent accessing cells in dependent or ambiguous manners. Example...

más de 7 años hace | 0

| aceptada

Respondida
How to increase the memory that MATLAB uses?
This was answered here: <https://www.mathworks.com/matlabcentral/answers/32332-increase-memory-used-by-matlab> Matla...

casi 8 años hace | 1

| aceptada

Respondida
How to assign error bar at middle of histogram?
Here are some suggestions. To see what each line is doing, remove the ";". %Store your data in cells so you can use loops....

casi 8 años hace | 0

Respondida
why i'm getting this error
If the outputs of |impulse| are not scalor values, then store the output into a cell, where each cell can store a different size...

casi 8 años hace | 2

| aceptada

Respondida
How do i find rows that contain duplicate values only?
x = [1 3 5 6; 2 3 6 4; 9 3 9 6; 3 3 3 3; 1 3 3 4] B = (x == 3); DelCol = sum(B, 1) == size(B, 1); DelRow = sum(B, 2) ...

casi 8 años hace | 0

| aceptada

Respondida
Finding mean of N matrices excluding 0 and without keeping all of them in memory
Assuming your variables are stored in 500 .mat files, like 'Var-1.mat', 'Var-2.mat'..., and your variable name is called "Data" ...

casi 8 años hace | 1

| aceptada

Respondida
How to add values to a matrix using for and if?
MP = [1 2; 2 1; 4 1]; nm = max(MP(:,1)); %OPTION 1: for loop MP2 = zeros(nm, size(MP, 2)); ...

casi 8 años hace | 2

| aceptada

Respondida
parfor: why is 2x memory being used for sliced variable?
Seems good to me. The memory consumption may not always be due to copying the entire cube_cell to all worker. Initializing a ...

casi 8 años hace | 0

| aceptada

Respondida
How to stop a plot when values get to negative.
Set the z-axis limit to stop drawing below or above certain ranges z = rand(10,10); x = linspace(0,1,10); y = linspac...

casi 8 años hace | 0

| aceptada

Respondida
Plotting only the part of matrix where a condition is met over consecutive rows
Data = [ 1 4 2 5 3 6 4 8 5 8 6 8 7 8 8 8 9 8 10 5 11 9 11 9]; ...

casi 8 años hace | 1

| aceptada

Respondida
how to format the axis of the plot?
%OPTION 1: Overwrite the XTickLabel property of the axes. (Simpler code but messy plot) plot([1:10]*10^6, 1:10) XTick = ...

casi 8 años hace | 0

| aceptada

Respondida
Is there a way to remove or rename a variable in a big MAT file?
You can use MEX code to delete a variable from a .mat file, but then you still have to save the variable via -append feature. Th...

alrededor de 8 años hace | 1

| aceptada

Respondida
How to generate multiple graphs per page in several pages in one loop?
N = 8; A = rand(100, N); %N is an integer number > 0 % I don't think you need this: % varnames_i = {'1','2','3','4'...

alrededor de 8 años hace | 0

| aceptada

Respondida
Convert Matlab function to Mex file - For loop conversion
1st issue is that you called mxCreateDoubleMatrix BEFORE Ixyzlength was initialized. Also, mxCreateDoubleMatrix 1st input takes ...

alrededor de 8 años hace | 1

| aceptada

Respondida
object orianted programing (OOP ) cant understand
Here are some suggestions for improving the code. See the comments in %. classdef main_code_oop < handle %make handle the ...

alrededor de 8 años hace | 0

Respondida
how to solve " Undefined function 'lt' for input arguments of type 'tf'. Error in ftfs (line 5) while (t < tf) ?"
The problem lies in understanding the scope of each variable used in Matlab. Here's a read on that: <http://matlab.izmiran.ru/h...

alrededor de 8 años hace | 1

| aceptada

Respondida
While loop: value increases, break if not.
You could use a *while* loop instead to run until a conditions is met, and it'll automatically break. i = 2; while x(i) ...

alrededor de 8 años hace | 0

| aceptada

Respondida
fullfile returns error. how to properly use it to perform this code below
Seems like |ext| is a logical value with the value of 1 or 0. The following will give you the same error message: ['a' 1>0]...

más de 8 años hace | 0

| aceptada

Respondida
how to evaluate a function in string with parfor?
For str2func, you also need to include the "@(var1, var2, var3, ...)" string. This is used to tell Matlab what part of the strin...

más de 8 años hace | 0

| aceptada

Respondida
Round RBG values to nearest multiple of 50
Try this (no for loop needed): RGB = [1 51 76 105 145 160 190 205]; RGB50 = round(a/50)*50; RGB50 = 0 50...

más de 8 años hace | 2

Respondida
im trying to write a code that switches each pixel with the average of its surrounding pixels. this is the code i wrote. for some reason it wont let the value of x go over 255. any help?
Image data can be stored in different data types: uint8, uint16, uint32, and double. Your image is in uint8 format (8bit per pix...

más de 8 años hace | 0

Respondida
Is there a way to convert MEX file into original C++ code
As discussed before in this Q&A link, it's VERY HARD to decompile a compiled mex code. <https://www.mathworks.com/matlabcent...

más de 8 años hace | 0

| aceptada

Respondida
How I could fix this error? Subscript indices must either be real positive integers or logicals.
When accessing a variable, you cannot use fractional values or values <= 0 when used as variable indices. Matlab only accepts in...

más de 8 años hace | 1

| aceptada

Respondida
How can I embed my .m file(function) in my GUI?
As @Adam mentioned, convert your user string to a function handle via parsing. Try this example and see if it works for your cas...

más de 8 años hace | 0

| aceptada

Cargar más