Respondida
Add field to a double array?
My best guess is that someone is trying to restructure *obj.mu* that had a double array into one that has two fields instead. It...

más de 8 años hace | 0

Respondida
Uniformly Distribute numbers on for loop?
Here's the vectorized form: rng(0, 'Twister'); a = -1; b = 3; x = randi([a, b], 100, 1); y = (x.^3) - sin(...

más de 8 años hace | 1

| aceptada

Respondida
How to get values from an array using another logical array
Instead of A(B) try A.*B

más de 8 años hace | 2

| aceptada

Respondida
Compare and compile matching values from various data set.
First, do not label variables dynmically like data1, data2, data3, etc.. as this will make your function very complicated. In yo...

más de 8 años hace | 0

| aceptada

Respondida
Error due to using the same varname in mat file and matlab function
Try to load the variables into a structure to prevent "poofing" them into your workspace, which can cause issues with overriding...

más de 8 años hace | 1

| aceptada

Respondida
Remove elements of a cell array if length<200
Y = Y(cellfun(@(x) length(x) >= 200, Y))

más de 8 años hace | 0

| aceptada

Respondida
How can I get the RGB values separately for an image taken using a webcam?
R = 255, G = 255, B = 255 is the RGB color for white when the data is in uint8 format( 0 - 255 ) values. The website below shows...

más de 8 años hace | 0

Respondida
What is wrong with this code?
Here are some other comments about the code to help with readability, etc: Function dcm = dcm2vol(din) %<-- "function" mus...

más de 8 años hace | 2

| aceptada

Respondida
loadind data loop fastly?
Not sure if this is faster or not, but your code could be simplified a lot. If you have parallel computing toolbox, you could di...

más de 8 años hace | 0

| aceptada

Respondida
How to use find when some of the searches will not return a result?
A is a Mx3 matrix, but you are trying to access A as a MxNx3 matrix, ex: A( A(:,1)==Y(i,j), A(:,2)==X(i,j), 3) %A is not ...

más de 8 años hace | 0

| aceptada

Respondida
I have 12 matrices of 145x1.how to get 1740x1 matrix taking each values from the columns first
%======================================================================== %If you labeled your variables inconveniently lik...

más de 8 años hace | 0

Respondida
Error when using isempty in a while loop
One issue you'll find is that the |input| will error out for number inputs such as: "1 2 3 4". If you only want string inputs, u...

más de 8 años hace | 0

Respondida
How to change the style of the plot box outline without affecting axis style?
I can't seem to find a way to change the axes line color individually... Workaround would be to draw 3 axes and adjust the line ...

más de 8 años hace | 1

| aceptada

Respondida
Why is compiled parfor repeatedly trying to start a parallel pool?
Your compiled application (which is pre 2016a) has access to parallel processing and will use the default parallel setting, whic...

más de 8 años hace | 0

Respondida
How can I replicate elements of a vector of into another
v2 = [1 1 1 1 3 1 4]; vx = cellfun(@(x) repmat(x, 1, x), num2cell(v2), 'uniformoutput', false); v3 = [vx{:}]; v3 = ...

más de 8 años hace | 0

Respondida
Mirror x-axis of Image but not the x-axis of the plot over top of it?
Try flipping the data stored in |im| instead of the x/y axes direction. im.CData = flipud(im.CData) %To flip image across...

más de 8 años hace | 0

| aceptada

Respondida
How to display the elements of a matrix D as an input for the next matrix 729x729 rows and columns?
Maybe you can make your own data structure and get/set methods to access them by 6-tuple char: Tuple = fullfact([3 3 3 3 3 ...

más de 8 años hace | 0

Respondida
Problems with the function plot
NEW ANSWER Somehow, setting to opengl renderer after Matlab starts causes an issue. I could replicate the bug if I do |op...

más de 8 años hace | 3

| aceptada

Respondida
using textscan to separate columns by delimiter
Here's how to open a file separated by space. See example data.txt. FID = fopen(FileName, 'r'); %Open file to read, save th...

más de 8 años hace | 0

Respondida
Why does my image keep disappearing from my GUI when I try to create a free hand mask?
NEW ANSWER For some reason, your gui is not saving the "crackdetection" variable prior to the Masking callback function. Your...

más de 8 años hace | 1

Respondida
How can I convert matrix to cell array of strings?
You could use |sprintf|. mat = [1 2 3; 4 5 6 ; 7 8 9]; arr = cell(1, size(mat, 1)); for k = 1:numel(arr) arr{k}...

más de 8 años hace | 1

| aceptada

Respondida
Create 58 graphs as a waterfall plot from 58 .csv files
You should use plot3 instead of plot to draw line in 3D. More info here: <https://www.mathworks.com/help/matlab/ref/plot3.htm...

más de 8 años hace | 1

| aceptada

Respondida
Adding the elements of a field of a struct
To fix this, transpose column vector to row like this: output(activityNum).distanceininches = zDistance(startind:endind).';...

más de 8 años hace | 0

Respondida
transparent background for scatter plot
imagesc will use the colormap of the figure, so if you want to use a different color scheme for scatter, calculate out the rgb v...

más de 8 años hace | 0

Respondida
How do I store larger and smaller values in a matrix?
I'm guessing this is what you see: denum = 1.0e+014 * 0.0000 0.0000 1.0000 0.0000 0.0000 1.0...

más de 8 años hace | 0

| aceptada

Respondida
why do I have this error in index
You are accessing a matrix using a non-integer index right here, which is not allowed. Index must be an integer > 0. Another iss...

más de 8 años hace | 0

Respondida
Loop for this program
Looks like |d| is a vector. You can use a logical array |( d < 27 )| to find where in |d| is under 27, and then use this logical...

más de 8 años hace | 0

Respondida
Can anyone help in explaining how the below code is detecting rain streaks???
clc % clear command window clear all % clear all variables close all % close all figures I=imread('heavyrain.jpg...

más de 8 años hace | 0

Respondida
For Loop Output as a Vector
a = [0; 1; 0; -1]; p4 = zeros(1, 601); z = linspace(-3,3,601); %leave z as a matrix, instead of using it as a for loop co...

más de 8 años hace | 0

Respondida
Each time I write my code I get this error 'Subscript indices must either be real positive integers or logicals.'
The issue is you are accessing a matrix using a non-integer index. That's not allowed in MATLAB. t = 0:0.05:40 %this is n...

más de 8 años hace | 0

| aceptada

Cargar más